Different Format in getdate() in SQL Server
In this SQL Server using GETDATE() to find different type of the Date format will be get the date.
1.Get MMM dd yyy Date Format:
select convert(varchar(10),GETDATE(),100) as Today
Result:
Jun 27 201
2.Get MM/dd/yyyy Date Format:
select convert(varchar(10),GETDATE(),101) as Today
Result:
06/27/2014
3.Get yyyy.MM.dd Date Format:
select convert(varchar(10),GETDATE(),102) as Today
Result:
2014.06.27
4.Get dd/MM/yyyy Date Format:
select convert(varchar(10),GETDATE(),103) as Today
Result:
27/06/2014
5.Get dd.MM.yyyy Date Format:
select convert(varchar(10),GETDATE(),104) as Today
Result:
27.06.2014
6.Get dd-MM-yyyy Date Format:
select convert(varchar(10),GETDATE(),105) as Today
Result:
27-06-2014
7.Get dd MMM yyy Date Format:
select convert(varchar(10),GETDATE(),106) as Today
Result:
27 Jun 201
8.Get MMM dd.yyy Date Format:
select convert(varchar(10),GETDATE(),107) as Today
Result:
Jun 27, 20
9.Get MMM dd yyy Date Format:
select convert(varchar(10),GETDATE(),109) as Today
Result:
Jun 27 201
10.Get MM-dd-yyyy Date Format:
select convert(varchar(10),GETDATE(),110) as Today
Result:
06-27-2014
11.Get yyyy/MM/dd Date Format:
select convert(varchar(10),GETDATE(),111) as Today
Result:
2014/06/27
12.Get yyyyMMdd Date Format:
select convert(varchar(10),GETDATE(),112) as Today
Result:
20140627
13.Get dd MMM yyy Date Format:
select convert(varchar(10),GETDATE(),113) as Today
Result:
27 Jun 201
14.Get dd MMM yyy Date Format:
select convert(varchar(10),GETDATE(),113) as Today
Result:
27 Jun 201
15.Get yyyy-MM-dd Date Format:
select convert(varchar(10),GETDATE(),120) as Today
Result:
2014-06-27
16.Get yyyy-MM-dd hh:mm:ss:mmm Date Format:
select convert(varchar(23),GETDATE(),121) as Today
Result:
2014-06-27 22:37:09.857
Comments
Post a Comment
Thank You for your Comment