• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error in createdatetime

New Here ,
Mar 02, 2009 Mar 02, 2009

Copy link to clipboard

Copied

<cfset schedindtl.presstime = 230>
<cfset schedindtl.pressdate = 20090308>
<cfset pressstart = #createdatetime(mid(schedindtl.pressdate,1,4),mid(schedindtl.pressdate,5,2),mid(schedindtl.pressdate,7,2),int(schedindtl.presstime/100),int(right(tostring(schedindtl.presstime),2)),0)#>
pressstart = #pressstart#

Looks like daylight savings time problem. Looking for help in fixing.

Views

3.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

No it doesn't.

 

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2022 Mar 16, 2022

Copy link to clipboard

Copied

Weird.

You and I have both reported bugs related to this issue:

 

https://tracker.adobe.com/#/view/CF-4212860

https://tracker.adobe.com/#/view/CF-4212875

 

I am curious to see how it all pans out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

LATEST

tclaremont basically has answered why the error happens (substitute the values of date, time & timezone to whatever the case you're seeing the error for, the reason is the same):

 

 

That date and time is precisely when daylight savings time occurs for the EST time zone in North America. At 2:00 AM it will become 3:00 AM, and therefore 2:00 AM does not exist on 3/8/2009.

 

A work-around is not to use createDateTime(), if you get error for:

 

createdatetime(2022,03,13,2,0,0)

 

Try using parseDateTime():

 

parseDateTime("2022-03-13 2:00:00am")

 

 

Note about this work-around:

  • The parsed date/time value can be 2022-03-13 3:00:00am instead of 2022-03-13 2:00:00am because in your (server) timezone the time jumps from 2022-03-13 1.59am to 2022-03-13 3.00am due to DST. So 2:00am is effectively just 3:00am on that day in the timezone

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation