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;
}
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