From a264cbc9b73b5515f3a77dda67fd55e4c94fca19 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 14 Jun 2009 11:22:39 +1200 Subject: [PATCH] Add function for converting ISO date to HTTP date. --- inc/always.php | 9 +++++++++ inc/always.php.in | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/inc/always.php b/inc/always.php index c06046af..221e5b21 100644 --- a/inc/always.php +++ b/inc/always.php @@ -257,3 +257,12 @@ function ConstructURL( $partial_path ) { return $url; } + +/** +* Convert a date from ISO format into the sad old HTTP format. +* @param string $isodate The date to convert +*/ +function ISODateToHTTPDate( $isodate ) { + // Use strtotime since strptime is not available on Windows platform. + return( gmstrftime('%a, %d %b %Y %T GMT', strtotime($isodate)) ); +} diff --git a/inc/always.php.in b/inc/always.php.in index d490dd82..e897402b 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -257,3 +257,12 @@ function ConstructURL( $partial_path ) { return $url; } + +/** +* Convert a date from ISO format into the sad old HTTP format. +* @param string $isodate The date to convert +*/ +function ISODateToHTTPDate( $isodate ) { + // Use strtotime since strptime is not available on Windows platform. + return( gmstrftime('%a, %d %b %Y %T GMT', strtotime($isodate)) ); +}