GMTDateFormat(aDate, offset)
Last updated March 21, 2002
Version: 1 | Requires: ColdFusion 5 | Library: DateLib
Description:
This takes two arguments, adate and offset. adate should be a valid date/time object, and offset should be a valid GMT offset (formatted +0000 or -0000, for example, Eastern Standard Time is -0500). It will then output a valid GMT string. It's especially usefull to help prevent browser and proxy caching.
Return Values:
Returns a string.
Example:
<cfoutput>
#GMTDateFormat(variables.oldtime,'-0500')#
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| aDate | A date. | Yes |
| offset | A valid GMT offset. | Yes |
Full UDF Source:
<cfscript>
/**
* This function takes a date time object and an offset, and outputs a GMT date/time formatted string.
*
* @param aDate A date.
* @param offset A valid GMT offset.
* @return Returns a string.
* @author Mark Andrachek (hallow@webmages.com)
* @version 1, March 21, 2002
*/
function GMTDateFormat (adate,offset) {
// adate must be a valid date time object.
// the offset must be in the format -0000 or +0000.
var dvalue = ""; // the final value.
if (IsDate(adate)) {
dvalue = DateAdd('h',Left(offset,3),DateAdd('s',Left(offset,1) & Right(offset,2),adate));
dvalue = Left( DayOfWeekAsString( DayOfWeek( dvalue ) ), 3) &
', ' &
DateFormat(dvalue,'dd mmm yyyy') &
' ' &
TimeFormat(dvalue,'HH:mm:ss') &
' GMT';
return dvalue;
}
else { return; }
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
3 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)