Issue converting datetime data in the ISO8601 format with timezone.

  • Hi,

    I am attempting to convert some datetime data into a varchar in the ISO8601 format with timezone.

    Executing the following two statements on my platform returns the same result however I according to BOL a Z should be placed at the end of style 127.

    select convert(varchar,getDate(),127)

    select convert(varchar,getDate(),126)

    Can anyone offer suggestions?

    Many Thanks,

    John

  • If you notice, there's a (6) footnote marker... The style with the "Z" is valid only when converting from VARCHAR to DATETIME... not when converting DATETIME to VARCHAR. Dunno why they did that...

    --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)

Viewing 2 posts - 1 through 1 (of 1 total)

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