Printing Dates

  • Comments posted to this topic are about the item Printing Dates

  • The dates in the question and in the answers do not match ๐Ÿ˜‰

  • Nice, easy one, thanks Steve

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    โ€œlibera tute vulgaris exโ€

  • Wouldn't '2019-01-18 20:23:10' print as Sep 1 2019 8:23 PM? ๐Ÿ™‚

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com

    Follow me on
    Twitter: @sqltwins

  • How does 2019-01-18 end up being Sep 1, 2019 too? ๐Ÿ˜‰

  • The correct answer is not available as an option

  • Looking at the available answers, the only logical response would be that it would fail, since all the other answers have both date and time that doesn't match the input at all. But knowing that PRINT happily works with datetime, I just went ahead and picked the answer with the matching format.

    It will be interesting to read Steve's explanation. My guess is he got two QOTD-s mixed up.


    Just because you're right doesn't mean everybody else is wrong.

  • Confused, dates do not match but the print answer is wrong as well. Looking forward to the explanation.

  • I agree with all the answers above, apart from Stewart Campbell who not only found it "easy" but apparently has a version of SQL Server that works differently from everyone else's! ;ยฌ}

  • The option answers are all wrong but only 1 is in the proper format so I choose that.

  • I think the question is broken, the correct answer is 'Jan 18 2019ย  8:23PM'

    ๐Ÿ™‚

     

  • roger.plowman wrote:

    I think the question is broken, the correct answer is 'Jan 18 2019ย  8:23PM'

    ๐Ÿ™‚ย 

    That's what I got when I ran it, after assuming that the date mismatch was a hint that the error was the answer.


    Puto me cogitare, ergo puto me esse.
    I think that I think, therefore I think that I am.

  • We aren't on SQL Server 2017, maybe we don't want to upgrade if this is the type of date conversion you get.ย  Just a joke, since the answers available have to be incorrect.

    -------------------------------------------------------------
    we travel not to escape life but for life not to escape us
    Don't fear failure, fear regret.

  • Yes,ย  the question and answers do not match.ย  That can only be the true answer.

  • I think this question is an excellent example of why you should never rely on defaults. ๐Ÿ˜‰

    --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 15 posts - 1 through 15 (of 20 total)

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