Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199901

Re: [PHP3] Date formatting. From: Adam Trachtenberg (adam <email protected>)
Date: 01/12/99

On Tue, 12 Jan 1999, Roger O. Svenning wrote:

> How do I format a 14 digit TIMESTAMP in a Mysql DB to a more readable
> date format like (01-12-1999) ?

Try something like this:

$mysql_date = 'YYYY-MM-DD HH:mm:SS';
list($year,$month,$day,$hour,$minute,$second) = split('[- :]', $mysql_date);
$seconds_since_epoch = mktime($hour,$minute,$second,$month,$day,$year);
$pretty_date = date('d-m-Y',$seconds_since_epoch);

-adam

-- 
/ adam maccabee trachtenberg | visit college life online \
\ adam <email protected>           | http://www.student.com    /

-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev <email protected>