RE: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ?

From: Date: Wed, 21 Feb 2001 11:51:28 +0000
Subject: RE: [PHP-DB] Is there a PHP equivalent of DATE_FORMAT ?
Groups: php.db 
Request: Send a blank email to php-db+get-6825@lists.php.net to get a copy of this message
Addressed to: "Timothy Wright" <tim.wright@01network.com> <php-db@lists.php.net> > I need to convert the input to a valid timestamp first. > > Any ideas?? Am I missing something really obvious...it's late and my brain > is tired.. Read the MySQL manual, section 7.4.11 Date and Time Functions http://www.mysql.com/doc/D/a/Date_and_time_functions.html You can convert a MySQL date to a Unix Timestamp, with UNIX_TIMESTAMP, but the real answer to your problem is: Just because MySQL returns it, that doesn't mean you have to print it. It does not cost that much to return a duplicate date on every record. You are going to be returning a unix timestamp on every record, and the fact of the matter that converting the internal date format to a uniz timestamp is as much a date formatting operation as DATE_FORMAT(). So, go ahead and use MySQL to format the value, and only print it the first time it appears. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.db (#6825) next »