Re: time from Mysql to php
| From: | Glen Scott | Date: | Tue, 02 Jan 2001 10:47:10 +0000 |
| Subject: | Re: time from Mysql to php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5522@lists.php.net to get a copy of this message | ||
Hi Kevin,
At 16:32 29/12/00, Kevin McCarthy wrote:
I have several tables that use a date field but for the life of me I can't figure how to use the values to show dates/times in various formats in PHP. The gist of it is, I capture timestamps in a MySQL record as '20001229162800'. I need to use this value to show a time/date in PHP but none of the PHP date/time functions seem to recognize this as a valid date string. Do I need to perform a conversion on this string in order to further format it in display?How about using the MySQL function DATE_FORMAT: examples: SELECT DATE_FORMAT('1999-12-31 23:00:00', '%r on %W') would produce 11:00:00 PM on Friday SELECT DATE_FORMAT('2001-11-05', '%D%M') would produce 5th November. Check out http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_and_time_functions for more information. Regards, Glen ----------------------------------------------------- Design Solution Limited t: +44 (0)1502 513008 f: +44 (0)1502 588622 e: info@designsolution.co.uk w: http://www.designsolution.co.uk Nouvotech House, Harbour Road, Oulton Broad, Suffolk, NR32 3LZ, UK -----------------------------------------------------