Yasir Malik wrote:
Given a date in MySQL datetime format, how do I extract the elements?
That is get the month, day, year, hour, ...

You could do it in the query using DATE_FORMAT(), MONTH(), YEAR(), etc.


You can do it in PHP by sending the MySQL timestamp through strtotime() and then using date() to extract each component.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to