This topic is locked

Convert Unix Timestamp

11/18/2009 5:40:50 AM
PHPRunner General questions
M
monoofy author

Dears,
I have a problem in converting Unix timestamp to Normal date

I searched the forum and found this to be used in View As "Custome":

if ($value);

$value = date("d/m/Y",$value);



I used it but it didn't work and returned a syntax error.

Could you please tell me what to do ??

M
monoofy author 11/19/2009

I'm really sorry guys, but I need it bad.

Could you please help ?

J
Jane 11/19/2009

Hi,
try to use this one:

if ($value);

$value = date("d/m/Y",strtotime($value));


If it doesn't help publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

A
anu 11/20/2009



I'm really sorry guys, but I need it bad.

Could you please help ?


In mysql query use date function.
DATE(Unix timestamp column name)as d1
--Anu

D
danaci 11/20/2009



In mysql query use date function.
DATE(Unix timestamp column name)as d1
--Anu


mysql version 5.0.51a
mysql> select date(unix timestamp evrak_kayit_tarihi) as d1 from gelen_evrak;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'timestamp evrak_kayit_tarihi) as d1 from gelen_evrak' at line 1

A
anu 11/20/2009



Dears,
I have a problem in converting Unix timestamp to Normal date

I searched the forum and found this to be used in View As "Custome":

if ($value);

$value = date("d/m/Y",$value);



I used it but it didn't work and returned a syntax error.

Could you please tell me what to do ??


====================================
To convert/view unix time stamp 2009-11-17 12:19:00 to a simple date like 2009-11-17 .
In PHPRUNNER

Select the Query tab of the project

select the table in which this date field is available.
Change the query like this:

I am using livedemos -orders table-orderdate as example:
SELECT

OrderID,

CustomerID,

EmployeeID,

DATE(OrderDate) as OrderDate2

From orders
Visual editor -OrderDATE -Properties ->Edit as date,view as select shortdate .

There is no need of custom expression in 'view as' if you want to display only date.
--Anu

M
monoofy author 11/20/2009

Many thanks all for your replies and specially Jane.

I tried your code but it gave me all as 1/1/1970.

Is there something wrong or something I should change ?
Thanks in advance

Sergey Kornilov admin 11/20/2009

I guess there is a problem with the way dates are stored in your database.
Show us examples of actual data in date column.

M
monoofy author 11/22/2009

Dear,
"1258282113" this is a sample of the stored data in the "create_date" field.

I need it to be shown in format "dd.mm.yyyy hh:mm:ss".

I want you also to know that I use this in the list page.

This project doesn't have add or edit pages.

I only use it for reporting.

M
monoofy author 11/22/2009

Dears,
I solved it I just used the code as following:

$value = date("d/m/Y H:i:s",($value));


But I have another problem, I want to search in date, but I can't.

The system needs me to search with UNIX and I sure want to search using the normal date format.

Can this be possible ?

Thanks

M
monoofy author 11/24/2009

Any help ??

J
Jane 11/24/2009

Hi,
you can format this value as date in the SQL query on the Edit SQL query tab. Use MySQL FROM_UNIXTIME function for that:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_from-unixtime