note 18996 added to function.date

From: Date: Tue, 12 Feb 2002 23:02:04 +0000
Subject: note 18996 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-26529@lists.php.net to get a copy of this message
Read further if you are getting dates far away into the future (2033). If you want to get a Timestamp (20020231164333 format) from a mysql database and format it into a readable output, use this command on your mySQL query, assuming you have something like SELECT lastaccesstime FROM user WHERE userid= 'hecky'; change it to SELECT date_format(lastaccesstime, '%M %e, %Y') FROM user WHERE userid = 'hecky'; this will format the date to a Month, date year. the % options should be the same as PHP ones, %M = month, %i = minutes, %Y = year , etc. As with PHP's date() function you customize the format. eg 'Year is %Y, and month is %M' =Year is 2002,and month is February Hope this helped -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+18996 http://master.php.net/manage/user-notes.php?action=delete+18996 http://master.php.net/manage/user-notes.php?action=reject+18996

« previous php.notes (#26529) next »