Re: Date() Problem

From: Date: Sat, 27 Jul 2002 09:35:24 +0000
Subject: Re: Date() Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109948@lists.php.net to get a copy of this message
> Hi, im making a tab/lyric portal, and for viewing tabs i want to display the > time the lyric/tab was submitted. So I retrive it from a MySQL database (as > a timestamp) and format it using the date function. The problem is, that the > date: 19-01-2038 04:14:07 is allways returned, even though in the > date > field the timestamp says (as an actual example) 20020723200919. > > Here is a shortened version of the script: > > <?php $submitdate = date("d-m-Y H:i:s", $values[4]); echo("Submitted on > $submitdate"); ?> > Hi Tony, the date() function in PHP does _only_ take UNIX timestamps as an argument which means that you can not run such a timestamp as the above. I recommend that you have a look at http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes the built-in functions for date-handling in MySQL. A function to look at could be DATE_FORMAT(). Regards, Jome

« previous php.general (#109948) next »