Skip to main content
December 1, 2010
Question

Weird CreateDateTime() Error

  • December 1, 2010
  • 1 reply
  • 1432 views

Works … <cfoutput>#createdatetime(2011,3,13,3,0,0)#</cfoutput>

Doesn’t work … <cfoutput>#createdatetime(2011,3,13,2,0,0)#</cfoutput>  … it is only hour 2 on March 3, 2011 that errors.

** Does Adobe have something against March 3rd, 2011 @ 2 am?

    This topic has been closed for replies.

    1 reply

    Inspiring
    December 1, 2010

    If you're in most parts of the USA, there is no 2am on 13/3/2011 (umm... "3/13/2011" to you, I guess). Daylight saving kicks in after the end of 01:59, and the time becomes 03:00.

    --

    Adam

    December 1, 2010

    Ah, I understand the Daylight Savings but don't understand why it flat out errors.  Am I suppose to catch this error?

    *** The isDate() will validate before using CreateDateTime().

    Inspiring
    December 1, 2010

    It errors because that time simply doesn't exist.  Just like there's no 37 o'clock that day (and you'd expect createDate(2011, 3, 13, 37, 0, 0) to error, yes?); there's no 2 o'clock either.  So either don't try to create that time, or if you must then - yes - you need to try/catch it.

    --

    Adam