I have a variable called date1
which contains a ColdFusion date/time object generated using parseDateTime
. When I dump the variable I get {ts '2014-12-20 15:46:57'}
.
I have another variable called date2
which contains another ColdFusion date/time object generated by dateConvert("local2utc",now())
. When I dump the variable I get {ts '2014-12-20 15:49:40'}
.
But when I do dateDiff("s",date1,date2)
I get -21436 which is far too many seconds. Can anybody explain why this happening? I think it might be a time zone issue but I can't get my head around it.
Repro code
<cfset dtString = "Saturday, December 20, 2014 05:07:30 PM">
<cfset dtObject = parseDateTime(dtString)>
<cfdump var="#dtObject#">
<cfset utcNow = dateConvert("local2utc",now())>
<br><br><cfdump var="#utcNow#">
<br><br><cfdump var="#dateDiff("s",dtObject,utcNow)#">