[ create a new paste ] login | about

Link: http://codepad.org/GGKoabbT    [ raw code | output | fork ]

PHP, pasted on Dec 17:
1
2
3
4
5
6
7
8
9
10
<?php
function perfect_date_format($date) {
    $dated = str_replace(array(" ", ":"), "-", $date);
    list($year, $month, $day, $hour, $minute) = explode("-", $dated);
    $niceday = @date("H:ia \o\\n\ l, F jS, Y", mktime($hour, $minute, 0, $month, $day, $year));
    return $niceday;
}

echo perfect_date_format('2011-12-17 03:45:00') . "\n";
?>


Output:
1
03:45am on Saturday, December 17th, 2011


Create a new paste based on this one


Comments: