January 8, 2008 at 8:13 am
Greetings follks. I use the getdate function for countless transactions. It always shows the date, hours, and minutes, but not the seconds. Is there a way to get it to display the seconds? Could it have to do with my datefields, which are all smalldatetime?
Greg
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
January 8, 2008 at 8:22 am
Yes. Smalldatetime only tracks to the minute level
Toni
January 8, 2008 at 8:26 am
Could it be to do with your regional settings? What happens if you do SELECT CAST (GETDATE() AS datetime)?
John
January 8, 2008 at 9:47 am
John Mitchell (1/8/2008)
Could it be to do with your regional settings? What happens if you do SELECT CAST (GETDATE() AS datetime)?John
If I do that I get seconds and miliseconds. If smalldatetime only tracks to the minute, why are my dates like this '2008-01-08 11:25:00'? It seems to have a place for the seconds, but they are always '00'.
Greg
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
January 8, 2008 at 10:01 am
Greg Snidow (1/8/2008)
John Mitchell (1/8/2008)
Could it be to do with your regional settings? What happens if you do SELECT CAST (GETDATE() AS datetime)?John
If I do that I get seconds and miliseconds. If smalldatetime only tracks to the minute, why are my dates like this '2008-01-08 11:25:00'? It seems to have a place for the seconds, but they are always '00'.
Greg
That is just the way it is displayed by Query Analyzer; notice that the minutes are always shown as 00.
Internally, smalldatetime values are stored in a binary format with 2 bytes for the date and 2 bytes for the time. The maximum number of unique values in 2 bytes is 65,536, so that is not enough to hold the 86,400 seconds in a day.
January 8, 2008 at 12:37 pm
Thanks for the info. I guess the extra storage space is not worth having visibility of the seconds for most of my applications.
Greg
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
January 8, 2008 at 6:55 pm
Heh... "It Depends"
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy