View Full Version : Problem using Date() function
3-23-02, 08:34 PM
I don't know what I'm doing wrong. =( Using Mascon, my datestamp looks correct. But when I call it back for display on a webpage, it grabs the date "January 18, 2038" for all ym queries. i am just calling the timestamp field of my DB using the following code which i got from the php.net webpage. What am I doing wrong?
$today = getdate($q_row[log_date]);
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year'];
echo "$month $mday, $year";
3-24-02, 10:16 PM
Only a little problem you have to have "" around log_date.
$today = getdate($q_row["log_date"]);
Also try printing $q_row[log_date] and seeing if it is a number not a string.
The date you are getting is probably the next Y2K bug.
( getdate returned false -1 )
Have fun PHPing
3-25-02, 01:24 AM
i found my answers here:
The MySQL timestamp format is NOT the same as the PHP timestamp format
(otherwise known as the Unix timestamp format).
MySQL uses a YYYYMMDDHHMMSS format whereas PHP uses a SSSSSSSSSSSS format
(number of seconds since some date which I don't know, but which I doubt
you ever really need to know either - enough to know it doesn't change).
Thursday 07th of February 2002 04:47:44 PM
MySQL timestamp: 20020207164744
PHP (Unix) timestamp: 1013096864
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.