Use the MySQL function that converts timestamp into Unixtime.
Or, better yet, use the MySQL function that outputs exactly the date
format you want, without dinking around with Unix timestamp in the
middle.
http://dev.mysql.com/
Search for date_format() I do believe.
It's gonna be a whole lot li
2:05 AM
To: PHP-General
Cc: John Taylor-Johnston
Subject: [PHP] echo date('Y-m-d', $mydata->timestamp);
$mydata->timestamp = "20070419162123";
echo date('Y-m-d', $mydata->timestamp);
result: 2038-01-18
?? What is wrong?? Should be 2007-04-19?
--
PHP G
John Taylor-Johnston wrote:
>
> It is actually a generated timestamp in MySQL.
> timestamp(14)
> Now what? I was hoping to avoid:
> |echo substr(|$mydata->timestamp|, 0, 8);
the simplest answer is actually yto make mySQL give you
the data in unix timestamp format in the first place:
SELECT UNIX_
On Sunday 22 April 2007 08:33, John Taylor-Johnston wrote:
> It is actually a generated timestamp in MySQL.
> timestamp(14)
Well, then just use the query to decide how it should look like.
Mysql timestamp is amazingly easy to work with.
whatevertable,date_format(timestamp_table, 'what should it lo
It is actually a generated timestamp in MySQL.
timestamp(14)
Now what? I was hoping to avoid:
|echo substr(|$mydata->timestamp|, 0, 8);
John
|Richard Lynch wrote:
On Sun, April 22, 2007 1:05 am, John Taylor-Johnston wrote:
$mydata->timestamp = "20070419162123";
echo date('Y-m-d', $mydata-
On Sun, April 22, 2007 1:05 am, John Taylor-Johnston wrote:
> $mydata->timestamp = "20070419162123";
>
> echo date('Y-m-d', $mydata->timestamp);
>
>
> result: 2038-01-18
>
> ?? What is wrong?? Should be 2007-04-19?
date() takes a Unix timestamp as its input.
Unix timestamps are measured as number
$mydata->timestamp = "20070419162123";
echo date('Y-m-d', $mydata->timestamp);
result: 2038-01-18
?? What is wrong?? Should be 2007-04-19?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
7 matches
Mail list logo