tracker issue : CF-4198463

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

ParseDateTime() with custom format gives incorrect results

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Jonas Meller / Jonas Meller ()

Created: 03/31/2017

Components: Documentation, Examples

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016.0.03.301771 / 303808

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Windows 7 64-bit

Vote Count: 0

Problem Description:
ParseDateTime() with custom format gives incorrect results in CF2016 with update 3.

Steps to Reproduce:
Two examples taken from the documentation at https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-m-r/parsedatetime.html
<cfset str = "Fri Jan 03 04:30:10 EDT 2014">
<cfset date = parsedateTime(str,"EEE MMM dd HH:mm:ss zzz yyyy")>
<cfoutput>#str# parsed as #date#</cfoutput>
<cfset string = "1997-07-16T19:20:30+01:00">
<cfset date = parseDateTime(string, "yyyy-MM-dd'T'HH:mm:ssX")>
<cfoutput>#string# parsed as #date#</cfoutput>

Actual Result:
Fri Jan 03 04:30:10 EDT 2014 parsed as {ts '2016-06-03 08:00:10'}
1997-07-16T19:20:30+01:00 parsed as {ts '1998-08-16 18:00:30'}

Expected Result:
CF10 with update 12 works better:
Fri Jan 03 04:30:10 EDT 2014 parsed as {ts '2014-01-03 08:30:10'}
1997-07-16T19:20:30+01:00 parsed as {ts '1997-07-16 18:20:30'}

I'm using -Duser.timezone=UTC in both CF10 and CF2016.

Attachments:

Comments:

it is a documentation bug, as the examples given are wrong. 'm' for minutes has been long deprecated and the examples should use the correct mask which is 'n'
Comment by Nikhil S.
976 | July 26, 2017 01:59:32 PM GMT