View comments | RSS feed
Contents > CFML Reference > ColdFusion Functions > GetHttpTimeString PreviousNext

GetHttpTimeString

Gets the current time, in the Universal Time code (UTC).

The time, as a string, according to the HTTP standard described in RFC 1123.

Date and time functions, International functions

GetHttpTimeString(date_time_object)

GetLocale, GetTimeZoneInfo, SetLocale

Parameter

Description

date_time_object

A ColdFusion date-time object string or Java Date object

The time in the returned string is UTC, consistent with the HTTP standard.

<cfoutput>
#GetHttpTimeString("#Now()#")#<br>
</cfoutput>

Contents > CFML Reference > ColdFusion Functions > GetHttpTimeString PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


isaac dealey said on Jan 3, 2004 at 4:46 PM :
the example provided here is generally considered "poor form" for the use of variables. Within the function GetHttpTimeString() there is no need for either quotes or pound symbols around the function now(). Or rather, pound symbols are only necessary if the unnecessary quotes are used. Well formed code would generally follow the form GetHttpTimeString(now()) instead.
dnimmich said on Jan 13, 2004 at 4:51 AM :
This command and its documentation is very confusing. First of all,
RFC 1123 doesn't refer to HTTP at all -- in fact, RFC 1123 predates
HTTP. Second, it only clarifies the date format defined in RFC 822,
which reads (with the clarification from RFC 1123):

[day, ] 1*2DIGIT month 4DIGIT hour zone

with day one out of "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
month one out of "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec", hour being 2DIGIT ":" 2DIGIT [":" 2DIGIT] and
zone "GMT", "UT" or a signed 4DIGIT time zone.

Unfortunately, GetHTTPTimeString() returns day and month depending
on the current locale, which means that if you use a non-English locale
the string isn't compliant to RFC 822 (and therefor, HTTP) dates.
Examples for German locale: "Di, 13 Jan 2004 12:47:26 GMT",
"Mo, 01 Mrz 2004 23:00:00 GMT".
halL said on Jan 14, 2004 at 7:19 AM :
You are correct that the function does not behave properly.
While the overall pattern is correct, it uses the day and month names from the default locale.
It should always use English names.
A bug (No. 53985) has been entered against this behavior.

Also, you are correct that we should mention both RFC 822 and 1123 on this page and that the specs predate HTTP.
A better statement would be something like
This function formats the date and time according to RFC 1123 and its underlying RFC, 822.
This format is commonly used in internet protocols, including HTTP.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi98.htm