tracker issue : CF-3700856

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

Add format mask to parseDateTime()

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 01/29/2014

Components: Documentation

Versions: 10.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Unknown

Locale/System: English / Platforms All

Vote Count: 1

See:
http://cfmlblog.adamcameron.me/2014/01/enhancement-suggestion-for-parsedatetime.html

parseDateTime() could be enhanced to take a mask string, so that it can understand any format, provided it can be given a guide as to which parts represent which in the string.  eg:

d = parseDateTime("1997-07-16T19:20:30+01:00", "yyyy-mm-ddTHH:nn:ssX");
d = parseDateTime("2000AD", "yyyyG"); // sic 

(format mask codes taken from "java.text.SimpleDateFormat")

-- 
Adam

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3700856

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE
Vote by External U.
13571 | January 29, 2014 08:52:58 AM GMT
Hey Adam (the other one), CF actually already has this! the docs are wrong. This works: <cfset string = "1997-07-16T19:20:30+01:00"> <cfset date = parseDateTime(string, "yyyy-MM-dd'T'HH:mm:ssX")> <cfdump var="#variables#"> I've let Rupesh know. -- Adam
Comment by External U.
13567 | February 04, 2014 07:14:22 AM GMT
Please take a look at the following page: https://wikidocs.adobe.com/wiki/display/coldfusionen/ParseDateTime
Comment by Frank J.
13568 | February 10, 2014 02:33:08 AM GMT
I think you need to change the name oft hat second argument: it's misleading. It might also be nice if you actually stated what the POP format actually *was*. Also: your code example for the formatting strings are *good* examples. your main code example is of the same dreadful quality of the rest of the docs though. What they hell have form submissions got to do with date parsing functions? Just demonstrate the function. Get rid of everything else. -- Adam
Comment by External U.
13569 | February 10, 2014 03:26:55 AM GMT
Fix verified. (Comment added from ex-user id:duttswam)
Comment by Adobe D.
13570 | June 18, 2015 12:16:53 AM GMT