Skip to main content
Participant
March 2, 2009
Question

Error in createdatetime

  • March 2, 2009
  • 12 replies
  • 4457 views
<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.
    This topic has been closed for replies.

    12 replies

    Inspiring
    March 13, 2022

    I am having a problem here:

     

    <cfscript>
    writeoutput(createdatetime(2022,03,13,2,0,0));
    </cfscript>

     

    Got this error:

    Date value passed to date function createDateTime is unspecified or invalid.

     

    Is this related w/ the JVM that I am using? Please help. Thanks.

    Inspiring
    March 13, 2022
    BKBK
    Community Expert
    Community Expert
    March 14, 2022

    @joseph.yan ,

    Does the following help as a workaround?

    • add the timezone flag to java.args in the jvm.config file. For example, I have added:
      -Duser.timezone=Europe/London
    tclaremont
    Inspiring
    March 5, 2009
    As long as we are thinking global, does CFFLUSH go counter-clockwise south of the equator? Something to think about when programming for a global market.
    tclaremont
    Inspiring
    March 5, 2009
    It was not a matter of ethnocentricism. I just know for a fact that CrystalTech is in Arizona and one of the exceptions to DST observations!
    Inspiring
    March 5, 2009
    >> Wait a minute. Wouldn't that time be perfectly valid for the portions of the
    >> US that do not observe daylight savings time? Arizona and Hawaii do not observe
    >> DST. Indiana did not observe DST until 2005.

    A can't *believe* I didn't have more concerted swipe at you for only
    considering USA when made your observation above.

    A wasted opportunity!

    ;-)

    --
    Adam
    Inspiring
    March 5, 2009
    > Wait a minute. Wouldn't that time be perfectly valid for the portions of the
    > US that do not observe daylight savings time? Arizona and Hawaii do not observe
    > DST. Indiana did not observe DST until 2005.

    Yep, and it'll work fine in those TZs. It's only when the server is
    configured to be in one of the affected TZs that it's a problem. I'm on
    GMT here and the code works fine, because our DLS boundary is different.
    29/3/2009 01:30 bombs for me.


    > CrystalTech, a popular CF webhost, is situated in Arizona, I believe. It would
    > seem to me that the server time would be perfectly valid on those boxes,
    > wouldn't it? Is it simply a matter of not applying the DST patch to those
    > machines?

    If one is serving content across TZs, one should really have the server set
    to UTC and have your code offset the time as per requirements. Paul
    Hastings might be watching out, and this would be his cue to jump in and
    explain all that. He's the expert.

    --
    Adam
    tclaremont
    Inspiring
    March 5, 2009
    It does seem like a more helpful error could be thrown in that instance, doesn't it?

    Wait a minute. Wouldn't that time be perfectly valid for the portions of the US that do not observe daylight savings time? Arizona and Hawaii do not observe DST. Indiana did not observe DST until 2005.

    CrystalTech, a popular CF webhost, is situated in Arizona, I believe. It would seem to me that the server time would be perfectly valid on those boxes, wouldn't it? Is it simply a matter of not applying the DST patch to those machines?
    tclaremont
    Inspiring
    March 4, 2009
    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.

    I can only guess that this is the rationale for it being an invalid date/time.
    Inspiring
    March 4, 2009
    That makes sense to me. Thanks for your assistance.
    djl2445Author
    Participant
    March 2, 2009
    If I change it from 230 to 330 it works. We are looking for fixes to the server OS.
    Inspiring
    March 4, 2009
    I am also getting this error. Seems to be a problem with the date 2009-03-08 and time of 2am.

    For example:

    CreateDateTime(2009, 3, 8, 2, 45, 0)

    Will through the following error:

    Date value passed to date function CreateDateTime is unspecified or invalid.
    Specify a valid date in CreateDateTime function.

    djl2445Author
    Participant
    March 2, 2009
    Version 8.0.1 We are looking at the server for patches. Is this to the operatings system or CF8. We didn't find a patch for CF8.
    tclaremont
    Inspiring
    March 2, 2009
    What version of CF? Have the daylight savings time patches been applied to the server? If you do a CFDUMP, what value is being passed to the server?