Correct HTTP date formatting function.

This commit is contained in:
Andrew McMillan 2012-03-16 16:44:59 +13:00
parent 863b4ac87f
commit 655f34aa27
2 changed files with 24 additions and 24 deletions

View File

@ -337,23 +337,23 @@ function ISODateToHTTPDate( $isodate ) {
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
$month = gmstrftime('%m', strtotime($isodate));
switch( intval($month) ) {
case 1: $month = 'January'; break;
case 2: $month = 'February'; break;
case 3: $month = 'March'; break;
case 4: $month = 'April'; break;
case 1: $month = 'Jan'; break;
case 2: $month = 'Feb'; break;
case 3: $month = 'Mar'; break;
case 4: $month = 'Apr'; break;
case 5: $month = 'May'; break;
case 6: $month = 'June'; break;
case 7: $month = 'July'; break;
case 8: $month = 'August'; break;
case 9: $month = 'September'; break;
case 10: $month = 'October'; break;
case 11: $month = 'November'; break;
case 12: $month = 'December'; break;
case 6: $month = 'Jun'; break;
case 7: $month = 'Jul'; break;
case 8: $month = 'Aug'; break;
case 9: $month = 'Sep'; break;
case 10: $month = 'Oct'; break;
case 11: $month = 'Nov'; break;
case 12: $month = 'Dec'; break;
default:
throw new Exception('Invalid month '.$month);
}
// Use strtotime since strptime is not available on Windows platform.
return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) );
return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) );
}
/**

View File

@ -337,23 +337,23 @@ function ISODateToHTTPDate( $isodate ) {
// It is necessary to use English for this, explicitly. See Debian BTS Bug#661985 for more info.
$month = gmstrftime('%m', strtotime($isodate));
switch( intval($month) ) {
case 1: $month = 'January'; break;
case 2: $month = 'February'; break;
case 3: $month = 'March'; break;
case 4: $month = 'April'; break;
case 1: $month = 'Jan'; break;
case 2: $month = 'Feb'; break;
case 3: $month = 'Mar'; break;
case 4: $month = 'Apr'; break;
case 5: $month = 'May'; break;
case 6: $month = 'June'; break;
case 7: $month = 'July'; break;
case 8: $month = 'August'; break;
case 9: $month = 'September'; break;
case 10: $month = 'October'; break;
case 11: $month = 'November'; break;
case 12: $month = 'December'; break;
case 6: $month = 'Jun'; break;
case 7: $month = 'Jul'; break;
case 8: $month = 'Aug'; break;
case 9: $month = 'Sep'; break;
case 10: $month = 'Oct'; break;
case 11: $month = 'Nov'; break;
case 12: $month = 'Dec'; break;
default:
throw new Exception('Invalid month '.$month);
}
// Use strtotime since strptime is not available on Windows platform.
return( gmstrftime('%a, '.$month.' %b %Y %H:%M:%S GMT', strtotime($isodate)) );
return( gmstrftime('%a, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) );
}
/**