Code: Select all
function convertDateFromISO8601ToRFC2822($date) {
preg_match('/(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+).(\d+)Z/',
$date, $time_matches);
list($x, $year, $month, $day, $hour, $minute, $second) =
$time_matches;
$timestamp = gmmktime($hour, $minute, $second, $month, $day, $year);
return gmdate('r', $timestamp);
}Example:
Code: Select all
echo convertDateFromISO8601ToRFC2822('1970-01-01T00:00:00Z');