tracker issue : CF-4198327

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

Strange Happenings with UTC Conversions

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): Steve Sommers / Steve Sommers ()

Created: 02/09/2017

Components: Core Runtime

Versions: 11.0

Failure Type: Others

Found In Build/Fixed In Build: 11,0,10,300066 /

Priority/Frequency: Normal /

Locale/System: English / Windows 7 SP1 64-bit

Vote Count: 0

Problem Description: DateTime comparisons seem to apply an underlying hidden time zone indicator to the comparison

Steps to Reproduce:
<cfscript>
	local.dttm1 = createDateTime(2017,02,01,01,00,00);
	local.dttm1UTC = dateConvert('local2utc', local.dttm1);

	local.dttm2 = createDateTime(2017,02,01,02,00,00);
	local.dttm2UTC = dateConvert('local2utc', local.dttm2);

	local.dttm3 = createDateTime(2017,02,01,03,00,00);
	local.dttm3UTC = dateConvert('local2utc', local.dttm3);

	local.dttm2a = parseDateTime("#dateTimeFormat(local.dttm2,'yyyy-mm-dd hh:nn:ss')#");
	local.dttm2aUTC = parseDateTime("#dateTimeFormat(local.dttm2UTC,'yyyy-mm-dd hh:nn:ss')#");
</cfscript>

<cfoutput>
	local.dttm1UTC = #local.dttm1UTC#<br />
	local.dttm2UTC = #local.dttm2UTC#<br />
	local.dttm3UTC = #local.dttm3UTC#<br />
	<br />
	local.dttm1UTC &lt; local.dttm2UTC = SHOULD BE YES<br />
	#local.dttm1UTC# &lt; #local.dttm2UTC# = #local.dttm1UTC LT local.dttm2UTC#<br />
	<br />
	local.dttm2UTC &lt; local.dttm3UTC = SHOULD BE YES<br />
	#local.dttm2UTC# &lt; #local.dttm3UTC# = #local.dttm2UTC LT local.dttm3UTC#<br />
	<br />
	local.dttm2aUTC = #local.dttm2aUTC#<br />
	<br />
	local.dttm1UTC &lt; local.dttm2aUTC = SHOULD BE YES<br />
	#local.dttm1UTC# &lt; #local.dttm2aUTC# = #local.dttm1UTC LT local.dttm2aUTC#<br />
	<br />
	local.dttm2aUTC &lt; local.dttm3UTC = SHOULD BE YES<br />
	#local.dttm2aUTC# &lt; #local.dttm3UTC# = #local.dttm2aUTC LT local.dttm3UTC#<br />
</cfoutput>

Actual Result:
local.dttm1UTC = {ts '2017-02-01 09:00:00'}
local.dttm2UTC = {ts '2017-02-01 10:00:00'}
local.dttm3UTC = {ts '2017-02-01 11:00:00'}

local.dttm1UTC < local.dttm2UTC = SHOULD BE YES
{ts '2017-02-01 09:00:00'} < {ts '2017-02-01 10:00:00'} = YES

local.dttm2UTC < local.dttm3UTC = SHOULD BE YES
{ts '2017-02-01 10:00:00'} < {ts '2017-02-01 11:00:00'} = YES

local.dttm2aUTC = {ts '2017-02-01 10:00:00'}

local.dttm1UTC < local.dttm2aUTC = SHOULD BE YES
{ts '2017-02-01 09:00:00'} < {ts '2017-02-01 10:00:00'} = YES

local.dttm2aUTC < local.dttm3UTC = SHOULD BE YES
{ts '2017-02-01 10:00:00'} < {ts '2017-02-01 11:00:00'} = NO

Expected Result:
Last line should = YES

Any Workarounds:
I had to use dateTimeFormat and compare strings which works but seems HIGHLY inefficient.

Attachments:

Comments:

Additional info here: https://forums.adobe.com/thread/2275223
Comment by Steve S.
1205 | February 09, 2017 12:20:17 AM GMT
@Steve I was unable to repro this bug on CF11HF10, output was as expected by you local.dttm2aUTC < local.dttm3UTC = SHOULD BE YES {ts '2017-01-31 08:30:00'} < {ts '2017-01-31 21:30:00'} = YES Are you still facing this issue ?
Comment by Dattanand M.
1206 | June 06, 2017 11:14:35 AM GMT
Yes, it's still an issue. question though: "Can't reproduce" - did you run the sample code and receive a different result?
Comment by Steve S.
1207 | September 18, 2017 03:27:34 PM GMT
@Steve I have tried the code on CF11HF10 and the output for the last line is as "YES" as expected. local.dttm2aUTC < local.dttm3UTC = SHOULD BE YES {ts '2017-01-31 08:30:00'} <{ts '2017-01-31 21:30:00'} = YES
Comment by Dattanand M.
1208 | September 19, 2017 06:12:04 AM GMT