Basic Date Function

  • Comments posted to this topic are about the item Basic Date Function

  • Your computer shows the following system date and time:

    If my computer showed that time I would be concerned that it's in US format and not Australian (UK) format! :w00t:

    And none of those functions would show a time 5 hours and 30 minutes earlier on my computer, because I am in Sydney and it's currently UTC+11 here during daylight savings, and UTC+10 the rest of the year. 😛

    If I were in the Indian Standard Timezone (UTC+0530) then sysutcdatetime() function would be the answer.

    Interesting question, I guess if you had mentioned your timezone in the question it might have made the time component more obvious and the question too easy.

  • This was removed by the editor as SPAM

  • +1 to the above points.

    Great question as far as idea and content goes, but needs clarification as to where you are in the world!!

  • Got it wrong - but only due to the reasons listed above - interesting points raised though

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • This question could've been better if the question asker realized there are more than one countries in the world.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I had almost missed the different time in the returned output, as I was focusing completely on the data type. Caught is just in time!

    I do not agree with some of the comments here that time zone of the computer was required to answer this. Once I saw that the time portion of the result was not the same as the listed system time, there was only one option left anyway.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • If my computer was displaying that as the system date and time I'd be complaining that GP had messed up the language /country settings. Wrong time and a non existant date.

    The difference between local time (GMT) and UTC is negligible and for most practical purposes may be ignored.

    As a result none of the answers would give the value requested.

  • Hugo Kornelis (2/13/2013)


    I had almost missed the different time in the returned output, as I was focusing completely on the data type. Caught is just in time!

    I do not agree with some of the comments here that time zone of the computer was required to answer this. Once I saw that the time portion of the result was not the same as the listed system time, there was only one option left anyway.

    +1

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Thanks. I liked this question. The half hour almost threw me off but I think there could only be one possible answer.

  • How can there be so many wrong answers??

    SYSDATETIME would just give you current time, there's no offset displayed, and CURRENT_TIMESTAMP doesn't give enough fractional seconds, so there's only one possible answer.

    It doesn't matter what time zone you are actually currently in, for the purposes of this question it is implied that you are in UTC+05:30.

    I thought it was a nice, simple, informative question, so thank you.

  • Hugo Kornelis (2/13/2013)


    Once I saw that the time portion of the result was not the same as the listed system time, there was only one option left anyway.

    That was my reasoning too, so I got it right.

    But then I thought, there's nothing to say that your computer and the sqlserver computer are in the same time zone. So sysdatetime() might potentially give that value as well.

  • sipas (2/13/2013)


    How can there be so many wrong answers??

    SYSDATETIME would just give you current time

    Because people like me read the question too quickly and don't notice that the time given in the output is different from the one given in the question? (That's not a problem with the question, I hasten to add, it's a problem with my reading comprehension skills!).

  • good question 🙂

    +1

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Because the question requires the user to make assuptions about how the end user's systems are configured which are defined in the question.

    In this case we don't know and have to infer

    what the timezone of the users PC is set to

    What language settings are set on the user's PC - specifically date formats

    what the timezone of the user's server with SQL server installed is set to

    What language settings are set on the user's server with SQL server installed - specifically date formats

    What language settings are set on the SQL server instance.

    If these differ from the questioner's setup then the correct answer is probably 'None of the above' which is not an option.

    Any question needs to ensure all information to answer it is provided and not need the answerer to make assumptions.

    In this case that could have been as simple as saying a default installation of MS Windows and SQL server for whichever region has that timezone (its not the only one with fractional hour offsets though).

Viewing 15 posts - 1 through 15 (of 55 total)

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