January 31, 2002 at 4:33 am
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 ?
Thanks
Joe
January 31, 2002 at 8:22 am
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
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
February 1, 2002 at 5:22 am
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.
Example:
CONVERT(VARCHAR,DATETIMEVALUE,100)
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