Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created March 25, 2014 10:40

Revisions

  1. bennadel created this gist Mar 25, 2014.
    12 changes: 12 additions & 0 deletions code-1.cfm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <!--- Get the current time. --->
    <cfset dtNow = Now() />

    <!---
    Convert the date to GMT using DateAdd() and DateConvert()
    to make sure that they are the same.
    --->
    DateAdd(): #DateAdd( "s", GetTimeZoneInfo().UTCTotalOffset, dtNow )#
    <br />

    DateConvert(): #DateConvert( "Local2UTC", dtNow )#
    <br />
    11 changes: 11 additions & 0 deletions code-2.cfm
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <!--- Get the GMT time. --->
    <cfset dtGMT = ParseDateTime(
    GetHTTPTimeString( Now() )
    ) />

    <!--- Convert from GTM back to local time. --->
    Now: #Now()#
    <br />

    DateConvert(): #DateConvert( "UTC2Local", dtGMT )#
    <br />