datetime stored as integer, please help!

  • Then I stand corrected.

    But that doesn't seem to be obvious though.. The dateadd function in particular, what variation is there to adding (or deleting) time that would be configured by the server? Some of the other date functions maybe, but not this one.. Am I missing something, or did they just mark it non-deterministic.

    CEWII

  • DateAdd month, if you're using the Arabic calendar or Chinese calendar, functions quite differently than if you're using the Gregorian calendar. All by itself, that makes the function non-deterministic.

    Edit: Hebrew calendar would be different too.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Sorry, I was completely forgetting about the other calendaring methods. Ah, American thinking.. Gotta love it..

    CEWII

  • Just a note when working with datetime stored as number/int...

    check if it is stored in seconds or milliseconds .. i.e if it is 10 characters or 13 characters...

    code to convert if seconds

    select dateadd(hour,-1,(dateadd(second,([your columnname]),'1/1/1970')))

    from [your table name]

    if milliseconds

    select dateadd(hour,-1,(dateadd(second,([your columnname]/1000),'1/1/1970')))

    from [your table name]

    hope this helps.

    Cheers 😀

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply