Sql Date Formats

Mittaikariss
Posted by Mittaikariss under Sql Server category on | Points: 40 | Views : 1985
select convert(varchar,getdate(),0)
--Dec 1 2011 10:28AM
select convert(varchar,getdate(),100)
--Dec 1 2011 10:29AM

select convert(varchar,getdate(),1) as todaydate
--12/01/11
select convert(varchar,getdate(),101) as todaydate
--12/01/2011

select convert(varchar,getdate(),2) as todaydate
--11.12.01
select convert(varchar,getdate(),102) as todaydate
--2011.12.01

select convert(varchar,getdate(),3) as todaydate
--01/12/11
select convert(varchar,getdate(),103) as todaydate
--01/12/2011

select convert(varchar,getdate(),4) as todaydate
--01.12.11
select convert(varchar,getdate(),104) as todaydate
--01.12.2011

select convert(varchar,getdate(),5) as todaydate
--01-12-11
select convert(varchar,getdate(),105) as todaydate
--01-12-2011

select convert(varchar,getdate(),6) as todaydate
--01 Dec 11
select convert(varchar,getdate(),106) as todaydate
--01 Dec 2011

select convert(varchar,getdate(),7) as todaydate
--Dec 01, 11
select convert(varchar,getdate(),107) as todaydate
--Dec 01, 2011

select convert(varchar,getdate(),8) as todaydate
--10:31:36
select convert(varchar,getdate(),108) as todaydate
--10:31:42

select convert(varchar,getdate(),9) as todaydate
--Dec 1 2011 10:31:48:640AM
select convert(varchar,getdate(),109) as todaydate
--Dec 1 2011 10:31:53:450AM

select convert(varchar,getdate(),11) as todaydate
--11/12/01
select convert(varchar,getdate(),111) as todaydate
--2011/12/01

select convert(varchar,getdate(),12) as todaydate
--111201
select convert(varchar,getdate(),112) as todaydate
--20111201

select convert(varchar,getdate(),13) as todaydate
--01 Dec 2011 10:32:17:793
select convert(varchar,getdate(),113) as todaydate
--01 Dec 2011 10:32:23:747

select convert(varchar,getdate(),14) as todaydate
--10:25:20:733
select convert(varchar,getdate(),114) as todaydate
--10:25:20:733

select convert(varchar,getdate(),20) as todaydate
--2011-12-01 10:26:35
select convert(varchar,getdate(),120) as todaydate
--2011-12-01 10:26:35

select convert(varchar,getdate(),21) as todaydate
--2011-12-01 10:27:12.030
select convert(varchar,getdate(),121) as todaydate
--2011-12-01 10:27:12.030

select convert(varchar,getdate(),126) as todaydate
--2011-12-01T10:28:16.310
select convert(varchar,getdate(),131) as todaydate
-- 6/01/1433 10:28:07:810AM



Refer by


--http://sqltutorials.blogspot.com
http://www.invomtech.com/

Comments or Responses

Login to post response