Wednesday, January 7, 2015

Date format in Sql Server

Introduction: In this article today I will explain Date format available in Sql server database.

                                                                         Output
SELECT CONVERT(VARCHAR,GETDATE(),100) -- Jan  7 2015 11:12AM
SELECT CONVERT(VARCHAR,GETDATE(),101) -- 01/07/2015
SELECT CONVERT(VARCHAR,GETDATE(),102) -- 2015.01.07
SELECT CONVERT(VARCHAR,GETDATE(),103) -- 07/01/2015
SELECT CONVERT(VARCHAR,GETDATE(),104) -- 07.01.2015
SELECT CONVERT(VARCHAR,GETDATE(),105) -- 07-01-2015
SELECT CONVERT(VARCHAR,GETDATE(),106) -- 07 Jan 2015
SELECT CONVERT(VARCHAR,GETDATE(),107) -- Jan 07, 2015
SELECT CONVERT(VARCHAR,GETDATE(),108) -- 11:23:08
SELECT CONVERT(VARCHAR,GETDATE(),109) -- Jan  7 2015 11:23:51:077AM
SELECT CONVERT(VARCHAR,GETDATE(),110) -- 01-07-2015
SELECT CONVERT(VARCHAR,GETDATE(),111) -- 2015/01/07
SELECT CONVERT(VARCHAR,GETDATE(),112) -- 20150107
SELECT CONVERT(VARCHAR,GETDATE(),113) -- 07 Jan 2015 11:25:17:203
SELECT CONVERT(VARCHAR,GETDATE(),114) -- 11:25:28:643
SELECT CONVERT(VARCHAR,GETDATE(),120) -- 2015-01-07 11:25:56
SELECT CONVERT(VARCHAR,GETDATE(),121) -- 2015-01-07 11:26:37.750
SELECT CONVERT(VARCHAR,GETDATE(),126) -- 2015-01-07T11:27:06.793
SELECT CONVERT(VARCHAR,GETDATE(),127) -- 2015-01-07T11:27:25.113
SELECT CONVERT(VARCHAR,GETDATE(),130) -- 17 ???? ????? 1436 11:27:50:19
SELECT CONVERT(VARCHAR,GETDATE(),131) -- 17/03/1436 11:28:15:207AM

Is this article helpful for you?

If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

No comments:

Post a Comment