mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-26 17:56:29 +00:00
gmstrftime is deprecated in PHP 8.1
Switch to using gmdate. One benefit is that gmdate doesn't respect the locale, so we don't need the logic to hardcode the month in English.
This commit is contained in:
parent
f1a4dcee0c
commit
1c77febeb1
@ -460,26 +460,8 @@ function DeconstructURL( $url ) {
|
||||
* @param string $isodate The date to convert
|
||||
*/
|
||||
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 = '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 = '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, %d '.$month.' %Y %H:%M:%S GMT', strtotime($isodate)) );
|
||||
return( gmdate('D, d M Y H:i:s T', strtotime($isodate)) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user