what date format is this?

  • Heh... no problem... if you think no coffee is bad, I'm trying to quit smoking... got anyone you want to take to a porkchop dinner? πŸ˜€

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (6/26/2008)


    Heh... no problem... if you think no coffee is bad, I'm trying to quit smoking... got anyone you want to take to a porkchop dinner? πŸ˜€

    Ahah that explains it, noticed something a little unusual about some of your recent posts :hehe: Good luck

    β€œWrite the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • Chris Morris (6/27/2008)


    Jeff Moden (6/26/2008)


    Heh... no problem... if you think no coffee is bad, I'm trying to quit smoking... got anyone you want to take to a porkchop dinner? πŸ˜€

    Ahah that explains it, noticed something a little unusual about some of your recent posts :hehe: Good luck

    Ummm, yeah... I know what you're talking about... it's not just the trying to quit smoking... there's some real stupid stuff going on a work and when I see that same stupid attitude on this forum, I tend to get a bit snappy about it. I appologize if it makes some of the good folks, like yourself, uncomfortable in any way...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden (6/26/2008)


    is250sp (6/26/2008)


    I am a visual person. Would you mind showing me examples of how I would incorporate this into the script above?

    Ummm... sure... here's the original script that Carl made...

    select cast('2007-11-19 15:29:00' as datetime ) as ExpectedTs

    , dateadd(ss,1195507770, cast('1970-01-01' as datetime )) - (6.0 / 24 ) as CalculatedTs

    ... you would make a simple substitution... the - (6.0 / 24 ) would be replaced by the forumula I gave...

    select cast('2007-11-19 15:29:00' as datetime ) as ExpectedTs

    , dateadd(ss,1195507770, cast('1970-01-01' as datetime )) + (GETDATE()-GETUTCDATE() ) as CalculatedTs

    Like I said and like Segiy just said... there is another factor that you have to in here... you have to add in when daylight savings time occurs and subtract (I think) an hour when DST kicks in not only for GETDATE(), but for when the date itself occurs.

    If you are looking for a way to convert date/times to different time zones using SQL check out this link:

    http://www.codeproject.com/useritems/ConvertUTCToLocal.asp

  • I contacted the vendor to inquire on how the app is converting the seconds to datetime and his response is.....

    The app doesnt recognize if it is daylight savings or not, it checks with the system date and time. So if the system time is set to daylight savings then the app also converts the date to daylight savings.

    Is there a way to do this in SQL?

Viewing 5 posts - 16 through 19 (of 19 total)

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