CFLib.org – Common Function Library Project

httpDate([theDate])

Last updated January 02, 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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson