Re: time from Mysql to php

From: Date: Sat, 30 Dec 2000 06:18:21 +0000
Subject: Re: time from Mysql to php
Groups: php.db 
Request: Send a blank email to php-db+get-5541@lists.php.net to get a copy of this message
Addressed to: Kevin McCarthy <kevin@bodynsoul.com> php-db@lists.php.net ** Reply to note from Kevin McCarthy <kevin@bodynsoul.com> Fri, 29 Dec 2000 16:32:24 -0800 > > 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? Take a look at: http://www.mysql.com/documentation/mysql/commented/manual.php?section=Date_and_time_functions Two functions of interest are: DATE_FORMAT(), and UNIX_TIMESTAMP() I suggest you use DATE_FORMAT to output the date in the desired format and be done with it... Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.db (#5541) next »