note 53039 deleted from function.mktime by derick

From: Date: Sun, 24 Sep 2006 11:59:24 +0000
Subject: note 53039 deleted from function.mktime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117510@lists.php.net to get a copy of this message
Note Submitter: taum at free dot fr ---- in response to chrisrobins at NOSPAM dot gmail dot com's note : You may as well use MySQL's UNIX_TIMESTAMP() function to convert a mysql timestamp to a unix timestamp. Here is a simple example : <?php // Query the database $q = mysql_query("SELECT date, UNIX_TIMESTAMP(date) AS timestamp FROM table"); $row = mysql_fetch_array($q); // then use PHP's date() function : $date = date("F j, Y, g:i a", $row['timestamp']); echo "$row[date] = $date"; // Will output : 2005-05-21 18:09:43 = May 21, 2005, 6:09 pm ?> Should be faster that using some regular expressions or other user-defined functions, and IMHO a lot easier ;-)

« previous php.notes (#117510) next »