New function: dateFromSQLDateTime() to convert a MySQL DATETIME string to

something that can be displayed on a Web page without looking butt-ugly.
This commit is contained in:
Jeff Teunissen 2000-05-08 19:46:29 +00:00
parent 44b7273f26
commit 40a97cb9f9

View file

@ -30,9 +30,17 @@
5=>'May', 6=>'Jun', 7=>'Jul', 8=>'Aug',
9=>'Sep', 10=>'Oct', 11=>'Nov', 12=>'Dec');
function fileParseDate($date) {
function fileParseDate($date)
{
global $shortMonths;
return substr($date, 3) . ' ' . $shortMonths[substr($date, 1, 2)];
return substr( $date, 3 ) . ' ' . $shortMonths[substr( $date, 1, 2 )];
}
function dateFromSQLDateTime( $sqlDateTime )
{
$time = explode( ' ', $sqlDateTime );
$date = explode( '-', $time[0] );
return strftime( '%d %b %Y', mktime( 0, 0, 0, $date[1], $date[2], $date[0]));
}
?>