Geeks With Blogs

Pankaj Tahiliani
Query: select convert( varchar(50), getdate(), 100)         
Output: Aug 19 2009 11:27AM

Query: select convert( varchar(50), getdate(), 101)
Output: 08/19/2009

Query: select convert( varchar(50), getdate(), 102)
Output: 2009.08.19

Query: select convert( varchar(50), getdate(), 103)
Output: 19/08/2009

Query: select convert( varchar(50), getdate(), 104)
Output: 19.08.2009

Query: select convert( varchar(50), getdate(), 105)
Output: 19-08-2009

Query: select convert( varchar(50), getdate(), 106)
Output: 19 Aug 2009

Query: select convert( varchar(50), getdate(), 107)
Output: Aug 19, 2009

Query: select convert( varchar(50), getdate(), 108)
Output: 11:28:54

Query: select convert( varchar(50), getdate(), 109)
Output: Aug 19 2009  2:09:50:200PM

Query: select convert( varchar(50), getdate(), 110)
Output: 08-19-2009

Query: select convert( varchar(50), getdate(), 111)
Output: 2009/08/19

Query: select convert( varchar(50), getdate(), 112)
Output: 20090819

Query: select convert( varchar(50), getdate(), 113)
Output: 19 Aug 2009 14:11:56:853

Query: select convert( varchar(50), getdate(), 114)
Output: 14:12:08:260

Query: select convert( varchar(50), getdate(), 120)
Output: 2009-08-19 14:12:24

Query: select convert( varchar(50), getdate(), 121)
Output: 2009-08-19 14:12:34.617

Query: select convert( varchar(50), getdate(), 126)
Output: 2009-08-19T14:13:04.243

Query: select convert( varchar(50), getdate(), 127)
Output: 2009-08-19T14:16:15.177

Query: select convert( varchar(50), getdate(), 130)
Output: 28 ????? 1430  2:16:22:960PM

Query: select convert( varchar(50), getdate(), 131)
Output: 28/08/1430  2:16:35:803PM
Posted on Wednesday, August 19, 2009 3:57 AM | Back to top


Comments on this post: T-SQL determine the correct format for datetime values

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Pankaj Tahiliani | Powered by: GeeksWithBlogs.net