diff --git a/inc/tz/expand.php b/inc/tz/expand.php index 9a068132..5b8cdff6 100644 --- a/inc/tz/expand.php +++ b/inc/tz/expand.php @@ -21,14 +21,14 @@ if ( empty($start) ) $start = sprintf( '%04d-01-01', date('Y')); if ( empty($end) ) $end = sprintf( '%04d-12-31', date('Y') + 10); $sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, '; -$sql .= 'to_char(last_modified AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; +$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; $sql .= 'FROM timezones WHERE tzid=:tzid'; $params = array( ':tzid' => $tzid ); $qry = new AwlQuery($sql,$params); if ( !$qry->Exec() ) exit(1); if ( $qry->rows() < 1 ) { $sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, '; - $sql .= 'to_char(last_modified AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; + $sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; $sql .= 'FROM timezones JOIN tz_aliases USING(our_tzno) WHERE tzalias=:tzid'; if ( !$qry->Exec() ) exit(1); if ( $qry->rows() < 1 ) $request->DoResponse(404); diff --git a/inc/tz/get.php b/inc/tz/get.php index c5f83c16..6317a988 100644 --- a/inc/tz/get.php +++ b/inc/tz/get.php @@ -17,14 +17,14 @@ if ( $format != 'text/calendar' ) { } $sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, '; -$sql .= 'to_char(last_modified AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; +$sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; $sql .= 'FROM timezones WHERE tzid=:tzid'; $params = array( ':tzid' => $tzid ); $qry = new AwlQuery($sql,$params); if ( !$qry->Exec() ) exit(1); if ( $qry->rows() < 1 ) { $sql = 'SELECT our_tzno, tzid, active, olson_name, vtimezone, etag, '; - $sql .= 'to_char(last_modified AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; + $sql .= 'to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'Dy, DD Mon IYYY HH24:MI:SS "GMT"\') AS last_modified '; $sql .= 'FROM timezones JOIN tz_aliases USING(our_tzno) WHERE tzalias=:tzid'; if ( !$qry->Exec() ) exit(1); if ( $qry->rows() < 1 ) $request->DoResponse(404); diff --git a/inc/tz/list.php b/inc/tz/list.php index de935b4d..8bb4d1fb 100644 --- a/inc/tz/list.php +++ b/inc/tz/list.php @@ -15,7 +15,7 @@ $response = new XMLDocument( array("urn:ietf:params:xml:ns:timezone-service" => $tzlist = $response->NewXMLElement('timezone-list'); $tzlist->NewElement('dtstamp', gmdate('Y-m-d\TH:i:s\Z')); -$sql = 'SELECT our_tzno, tzid, active, to_char(last_modified AT TIME ZONE \'UTC\',\'YYYY-MM-DD\"T\"HH24:MI:SS"Z"\') AS last_modified, olson_name, vtimezone FROM timezones'; +$sql = 'SELECT our_tzno, tzid, active, to_char((last_modified::timestamp WITH TIME ZONE) AT TIME ZONE \'UTC\',\'YYYY-MM-DD\"T\"HH24:MI:SS"Z"\') AS last_modified, olson_name, vtimezone FROM timezones'; $params = array(); $where = ''; if ( $returnall !== true ) {