October 4, 2005 at 4:28 pm
I am continually amazed at the lack of functions within TSQL. I like the product, but you would have thought that at this day and age of computer programming, the writers of TSQL would have put more functions in their product.
They have a datatype which holds date and time, yet there is no function to easily separate out the two. There is a day, month, and year function to work on datetime, but no time functions.
so, my question is, after all this ranting, is there some special function somewhere to extract out the time, like "hour(getdate())"?, or do I need to use the convert/cast functions to edit out the hour?
Thanks for any and all help.
Russ....
October 4, 2005 at 4:34 pm
have you looked at datepart()?
select datepart(hh,getdate())
Returns an integer representing the specified datepart of the specified date.
DATEPART ( datepart , date )
datepart
Is the parameter that specifies the part of the date to return. The table lists dateparts and abbreviations recognized by Microsoft® SQL Server™.
Datepart | Abbreviations |
---|---|
year | yy, yyyy |
quarter | qq, q |
month | mm, m |
dayofyear | dy, y |
day | dd, d |
week | wk, ww |
weekday | dw |
hour | hh |
minute | mi, n |
second | ss, s |
millisecond | ms |
October 4, 2005 at 4:37 pm
I feel like an idiot and I must be going blind.
Thanks
Russ...
October 4, 2005 at 4:45 pm
If your not going blind, then your not doing it right.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply