nice_date([$bad_date = ''[, $format = FALSE]])
Parameters: |
|
---|---|
Returns: |
Formatted date |
Return type: |
string |
This function can take a number poorly-formed date formats and convert them into something useful. It also accepts well-formed dates.
The function will return a UNIX timestamp by default. You can, optionally, pass a format string (the same type as the PHP date()
function accepts) as the second parameter.
Example:
$bad_date = '199605'; // Should Produce: 1996-05-01 $better_date = nice_date($bad_date, 'Y-m-d'); $bad_date = '9-11-2001'; // Should Produce: 2001-09-11 $better_date = nice_date($bad_date, 'Y-m-d');
Please login to continue.