CFLib.org – Common Function Library Project

GetTimeStampFromHttpTimeString(httpTime)

Last updated November 26, 2001

author

Chris Wigginton

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Takes an HttpTimeString ("Thu, 25 Oct 2001 20:17:00 GMT") and converts it to a timestamp ({ts '2001-10-25 20:17:00'}).

Return Values:
Returns a timestamp string.

Example:

<cfset httpTime = GetHttpTimeString(Now())>
<cfset timeStamp = GetTimeStampFromHttpTimeString(httpTime)>

<CFOUTPUT>
Timestamp=#timestamp#
</CFOUTPUT>

Parameters:

Name Description Required
httpTime HttpTimeString Yes

Full UDF Source:

/**
 * Converts HttpTimeString into a timestamp string.
 * 
 * @param httpTime      HttpTimeString 
 * @return Returns a timestamp string. 
 * @author Chris  Wigginton (cwigginton@macromedia.com) 
 * @version 1, November 26, 2001 
 */
function GetTimeStampFromHttpTimeString(httpTime) {
    var dateParts = ListToArray(httpTime, " ");
    var timeStamp = "{ts '" & dateParts[4] & "-" & DateFormat("#DateParts[3]#/1/2000", "mm") & "-" & dateParts[2] & " " & dateParts[5] & "'}";
    return timeStamp;
}

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