mirror of
https://git.code.sf.net/p/quake/website
synced 2024-11-27 22:42:57 +00:00
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:
parent
44b7273f26
commit
40a97cb9f9
1 changed files with 10 additions and 2 deletions
12
lib/date.php
12
lib/date.php
|
@ -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]));
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue