Page 1 of 1

PHP Date Format

Posted: Wed Nov 20, 2002 1:06 am
by cfdarby
I have a variable created from data taken out of a mySQL database the variable is a date value in the format YYYY/MM/DD i need to beable to format this date and also retrieve a unix timestamp from it, ive looked all through the PHP documentation and couldnt find anything to allow me to format a variable, maybe i missed something, can someone point me in the right direction

Chris

Date Format...

Posted: Wed Nov 20, 2002 1:21 am
by rlogin
To format a Unix Time stamp use strftime() function.
To format a GMT time value, use gmdate().

Posted: Wed Nov 20, 2002 2:37 am
by twigletmac
If you're storing the date in a date or timestamp field in MySQL (which makes life a lot easier) you can easily format it using MySQL when you retrieve it:
http://www.mysql.com/doc/en/Date_and_ti ... tions.html

Mac