portal entry

select a category, or use search below
(searches all categories and all time range)
Title:

dateDiff/dateconvert problems when trying to create epoch times

| View in Portal
April 10, 2019 06:12:45 PM GMT
1 Comment
<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>
Labels: cffunction, CFML Tag/Function, Question, 2018, cfml tag/function, question

Comments:

<p>Try this and see if it gives you the results your lookings for.</p><p>#DateDiff(“s”, “January 1 1970 00:00?, dateTimeFormat(utcTime,”mm-dd-yyyy hh:nn tt”) )#</p><p> </p>
Comment by BigRigMike
1990 | April 11, 2019 08:02:23 PM GMT