Title:
dateDiff/dateconvert problems when trying to create epoch times
|
View in Portal
<p>My local server’s timezone is set to UTC-8 – https://www.screencast.com/t/1qqid95lR3v I need to create epoch time for UTC so I’m trying to use the following function: #DateDiff(“s”, “January 1 1970 00:00:00”, dateconvert(“local2utc”, now()))# The dateconvert function does not compute the correct time using any combination. Here is example code: <cfset utcTime = dateconvert("local2utc", now())> <cfoutput> now: #now()# <br>local2utc: #utcTime# <br>epoch (now){currentTime:#DateDiff("s", "January 1 1970 00:00:00", now())#} <br/>epoch (local2utc){currentTime:#DateDiff("s", "January 1 1970 00:00:00", dateconvert("local2utc", now()))#} <br>epoch (utcTimeVar){currentTime:#DateDiff("s", "January 1 1970 00:00:00", utcTime)#} […]</p>
<p>The post <a rel="nofollow" href="https://coldfusion.adobe.com/2019/04/datediff-dateconvert-problems-trying-create-epoch-times/">dateDiff/dateconvert problems when trying to create epoch times</a> appeared first on <a rel="nofollow" href="https://coldfusion.adobe.com">ColdFusion</a>.</p>
Comments: