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
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 of seconds
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',
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
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
You are misunderstanding what timestamp means. The value of a timestamp
is from UNIX epoch http://en.wikipedia.org/wiki/Unix_time. It is
calculated by the number of seconds after January 1st, 1970. Also note,
that you are overflowing the integer, which is giving you a
6 matches
Mail list logo