Function sanitize_date
Sanitizes a date string.
DateTime fails to parse date strings that contain brackets, such as “Tue Dec 22 2015 12:52:19 GMT+0100 (West-Europa)”, which appears in PO-Revision-Date headers. Sanitization ensures such date headers are parsed correctly into DateTime instances.
string |
$date_string |
The date string to sanitize. |
DateTime
|
Date from string if parsable, otherwise the Unix epoch. |