Created
March 25, 2014 10:40
Converting To And From GMT / UTC Time In ColdFusion Using DateConvert()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 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 /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Get the GMT time. ---> | |
<cfset dtGMT = ParseDateTime( | |
GetHTTPTimeString( Now() ) | |
) /> | |
<!--- Convert from GTM back to local time. ---> | |
Now: #Now()# | |
<br /> | |
DateConvert(): #DateConvert( "UTC2Local", dtGMT )# | |
<br /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment