Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wawansur
Starting Member
44 Posts |
Posted - 2009-07-27 : 03:42:04
|
any alternative to get data of time from system datetime ?i want me with format "hh:mm:ss"i use this query, but i think its not simpleSELECT DATEPART(hh, GETDATE()),DATEPART(mi, GETDATE()),DATEPART(ss, GETDATE())Rgds |
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-27 : 03:45:16
|
HiTry this..SELECT CONVERT(VARCHAR(8),GETDATE(),114)SELECT CONVERT(VARCHAR(20),GETDATE(),114)-------------------------R.. |
|
|
wawansur
Starting Member
44 Posts |
Posted - 2009-07-27 : 04:22:02
|
quote: Originally posted by rajdaksha HiTry this..SELECT CONVERT(VARCHAR(8),GETDATE(),114)SELECT CONVERT(VARCHAR(20),GETDATE(),114)-------------------------R..
but we got the varchar data type, not datetime type.how to convert this?Rgds |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-07-27 : 04:54:43
|
quote: Originally posted by wawansur any alternative to get data of time from system datetime ?i want me with format "hh:mm:ss"i use this query, but i think its not simpleSELECT DATEPART(hh, GETDATE()),DATEPART(mi, GETDATE()),DATEPART(ss, GETDATE())Rgds
Where do you want to show data?MadhivananFailing to plan is Planning to fail |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-07-27 : 05:06:38
|
[code]select getdate() - dateadd(day, datediff(day, 0, getdate()), 0)[/code] KH[spoiler]Time is always against us[/spoiler] |
|
|
|
|
|
|
|