• Hi

    1. A datetime value ( with out milliseconds) is converted into float.

    2. when the same float value is converted back into datetime the milliseconds comeback.

    I get an input in float value, this has to be stored as the corresponding datetime value without milliseconds. How is this possible ?



  • The datetime data type is going to store the milliseconds, it's part of the data type. However, if you want to eliminate milliseconds, you might want to do something like:

    DATEADD(ms, -1 * DATEPART(ms, MyDate), MyDate)

    That ensures you're setting the millisecond part to zero.

    K. Brian Kelley

    K. Brian Kelley

  • If you are concerned for when it is displayed then look at CONVERT in SQL Books Online and you will find some helpfull items that will help you return a specific format.



    Will return in the format

    mon dd yyyy hh:miAM (or PM)

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

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