Unable to handle RFC822 datetime string with Z for timezone

Description

The above works as expected, handling foo as a date, in ACF 10/11, but in Lucee throws an error.

The workaround is as follows

Activity

Michael Offner 
28 October 2024 at 13:19

The issue you're seeing with the dateTimeFormat function isn't actually a bug. The format hh in your pattern (yyyy-mm-dd hh:nn:ss) is for 12-hour time, which means it's working as expected. In the 12-hour clock, 00:00:00 gets shown as 12:00:00 AM, which is why you're seeing 12 instead of 00.

If you're looking for the 24-hour format (where midnight is 00:00:00), you just need to change hh to HH. So, this isn't something broken—just how the 12-hour clock works in the pattern you're using.

Michael Offner 
28 October 2024 at 13:18

reported by

Michael Offner 
21 May 2024 at 19:22

added and extended test case

Pothys - MitrahSoft 
11 December 2018 at 08:33

I've added a test case for this ticket & confirmed the issue happened on lucee.

Pull request: https://github.com/lucee/Lucee/pull/616

Samuel W. Knowlton 
11 July 2016 at 20:12
(edited)

An alternate example (in 5.1 beta):

This works:

Adding the timezone does not (but does in ACF 10). Lucee's parseDateTime has an optional timezone argument but I am not sure that it applies here as 'ZZZ' appears to be an acceptable value:

http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

(throws can't cast value to a Date Object)

Unresolved

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Priority

Created 15 September 2015 at 09:38
Updated 28 October 2024 at 13:19