SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to get current time with common format ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hdv212
Posting Yak Master

Iran
140 Posts

Posted - 04/22/2009 :  04:24:09  Show Profile  Send hdv212 a Yahoo! Message  Reply with Quote
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

Sweden
30111 Posts

Posted - 04/22/2009 :  04:25:08  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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

Iran
140 Posts

Posted - 04/22/2009 :  04:34:58  Show Profile  Send hdv212 a Yahoo! Message  Reply with Quote
Thanks Peso.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000