What is the Best Way for Comparing Datetime value in SQLSERVER 2000?

  • Then why not 121( "yyyy-mm-dd")  ?

    Does it make any prob if i use 121 insteed of (style 112)

    Is the any significant dif btn them?

     



    ..Better Than Before...

  • I have never used 121 format but according to BOL it is format:

    yyyy-mm-dd hh:mi:ss.mmm(24h)

    This obviously includes time.  You say in your first post "in my application  I need only date not time" so surely 112 would be the option you should use, as this is yyyymmdd without time?

    So, in answer to your question, there is a significant difference in that 121 includes time and 112 does not.

  • Well, to be perfectly honest, in my current system I use the yyyy-mm-dd style. It is however made a "standard" - so mainly that is why it's been used. We do enforce that the client side use the same notation - else we don't accept it as input. It is also how we Swedes use to write dates.

    Having said that - despite the above - it is still better to make a habit of using yyyymmdd when dealing with dates that either are coming to you from some external source (you make a demand that file data conforms to this format), or when you are extracting dates from your system to be used somewhere else. If you do this, you can always be sure that no misunderstandings may happen on the way.

    And to add to that, it's always easier to deal with a homogenous string than a string that's chopped up by some delimiter. (delimiter's arent part of the date, so you must always take extra care when they are present)

    yyyymmdd is the same all around the world, and the bottom line is that leaving out delimiters totally makes a lot of things much easier.

    Of course, it's up to each and everyone to do what they please and feel is right for them, I'm just trying to spread some awareness about what may happen if caught unaware.

    =;o)

    /Kenneth

Viewing 3 posts - 16 through 17 (of 17 total)

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