note 74687 deleted from function.date by felipe

From: Date: Sun, 09 Dec 2007 13:34:00 +0000
Subject: note 74687 deleted from function.date by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-132990@lists.php.net to get a copy of this message
Note Submitter: josh ---- Ever had a DATETIME in a database and want to format it using the date() function? Me too. Here you go. <? // format MySQL DateTime (YYYY-MM-DD hh:mm:ss) using date() function datetime($syntax,$datetime) { $year = substr($datetime,0,4); $month = substr($datetime,5,2); $day = substr($datetime,8,2); $hour = substr($datetime,11,2); $min = substr($datetime,14,2); $sec = substr($datetime,17,2); return date($syntax,mktime($hour,$min,$sec,$month,$day,$year)); } ?>

« previous php.notes (#132990) next »