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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to get current time with common format ?

Author  Topic 

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-22 : 04:24:09
Hi
how to get current time in common format like this :
hour:minute:second:milisecond -> 23:12:45:87
or
hour-minute-second-milisecond -> 23-12-45-87

does datetime dataType in sql server 2005 support this ?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-22 : 04:25:08
Yes. You will have to CONVERT the datetime to a string.

SELECT CONVERT(VARCHAR(30), GETDATE(), 114)




E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

hdv212
Posting Yak Master

140 Posts

Posted - 2009-04-22 : 04:34:58
Thanks Peso.
Go to Top of Page
   

- Advertisement -