Re: note 28458 added to function.substr

From: Date: Tue, 14 Jan 2003 06:53:04 +0000
Subject: Re: note 28458 added to function.substr
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42098@lists.php.net to get a copy of this message
A more flexible solution is to use the MySQL functuion DATE_FORMAT(), or even use MySQL's UNIX_TIME() with PHP's date() in combination. I added an editor's note to that respect to your contribution. If you rather I remove your note, let me know soon. More details on the MySQL functions at: http://www.mysql.com/doc/en/Date_and_time_functions.html --- ellipse@optonline.net wrote: > Here is a handy function, at least to me it is, to > convert mysql returned timestamp(14) data-type into > yyyy-mm-dd hh:mm:ss format: > > function get_DateTime ($string) > { > $yyyy = substr($string, 0,4); > $month = substr($string, 4,2); > $dd = substr($string, 6,2); > $hh = substr($string, 8,2); > $mm = substr($string, 10,2); > $ss = substr($string, 12,2); > $ftime = "$yyyy-$month-$dd $hh:$mm:$ss"; > return $ftime; > } > > Pretty much self-explanatory. > -- > http://www.php.net/manual/en/function.substr.php > http://master.php.net/manage/user-notes.php?action=edit+28458 > http://master.php.net/manage/user-notes.php?action=delete+28458 > http://master.php.net/manage/user-notes.php?action=reject+28458 > > > -- > PHP Notes Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== --- Jesus M. Castagnetto <jmcastagnetto@php.net> __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com

« previous php.notes (#42098) next »