CFLib.org – Common Function Library Project

httpDate([theDate])

Last updated January 2, 2004

author

Massimo Foti

Version: 1 | Requires: CF6 | Library: StrLib

Description:
The HTTP specifications requires a very specific format for dates, this is very important if you want to manipulate HTTP headers using the <cfheader> tag

Return Values:
Returns a string.

Example:

<cfoutput>#httpDate(CreateDate('1969', '8', '9'))#</cfoutput>

Parameters:

Name Description Required
theDate A date to format. Defaults to Now(). No

Full UDF Source:

<!---
 Format a date as required by HTTP specifications
 
 @param theDate 	 A date to format. Defaults to Now(). (Optional)
 @return Returns a string. 
 @author Massimo Foti (massimo@massimocorner.com) 
 @version 1, January 2, 2004 
--->
<cffunction name="httpDate" output="true" returntype="numeric" hint="Format a date as required by HTTP specifications">
	<cfargument name="theDate" type="date" required="false" default="#Now()#" hint="Date to format, default to Now()">
	<cfset var returnDate="#DateFormat(arguments.theDate, 'ddd, dd mmm yyyy')# #TimeFormat(arguments.theDate, 'HH:mm:ss')# GMT">
	<cfreturn returnDate>
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson