php-db | 2001011
Date: 01/02/01
- Next message: Adv. Systems Design: "RE: [PHP-DB] sorting"
- Previous message: Wesley Choate: "RE: [PHP-DB] sorting"
- Next in thread: Jaskirat Singh: "Re: [PHP-DB] time from Mysql to php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected>
w: http://www.designsolution.co.uk
Nouvotech House, Harbour Road,
Oulton Broad, Suffolk, NR32 3LZ, UK
-----------------------------------------------------
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Adv. Systems Design: "RE: [PHP-DB] sorting"
- Previous message: Wesley Choate: "RE: [PHP-DB] sorting"
- Next in thread: Jaskirat Singh: "Re: [PHP-DB] time from Mysql to php"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

