Date - Time Formatting in SQL


The Below shows for date and time formatting in sql

Here is a list of sql queries which is used for common date and time formatting

SQL Query Output you see



SELECT CONVERT(VARCHAR(20), GETDATE(), 100) 11/23/98

SELECT CONVERT(VARCHAR(10), GETDATE(), 101) 11/23/1998

SELECT CONVERT(VARCHAR(8), GETDATE(), 2) 72.01.01

SELECT CONVERT(VARCHAR(10), GETDATE(), 102) 1972.01.01

SELECT CONVERT(VARCHAR(8), GETDATE(), 3) 19/02/72

SELECT CONVERT(VARCHAR(10), GETDATE(), 103) 19/02/1972

SELECT CONVERT(VARCHAR(10), GETDATE(), 105) 24-01-1998

SELECT CONVERT(VARCHAR(9), GETDATE(), 6) 04 Jul 06

SELECT CONVERT(VARCHAR(12), GETDATE(), 107) Jan 24, 1998

SELECT CONVERT(VARCHAR(24), GETDATE(), 113) 28 Apr 2006 00:34:55:190

SELECT CONVERT(VARCHAR(26), GETDATE(), 130) 28 Apr 2006 12:39:32:429AM


Related Articles

SQL DATE Time Convert

During Sql Queries most of the time we need to manipulate the format of Date below I am trying to cover most of the format of date time in sql queries.

More articles: Date formatting Date and Time formats

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: