SQL Server date and time format conversion string

Source: Internet
Author: User

Recently, the date and time format conversion was used to design the database table structure. After a long time, I had to worry about it for a long time. I found that I forgot a lot of things I learned before.

It seems that it is easy to forget that it is not commonly used. Repeat the SQL Server date and time format conversion string. In the SQL Server database,

The SQL Server date and time format conversion string can change the SQL Server date and time format, which should be mastered by each SQL database user.

Datetime to string:

  1. Select convert (varchar (100), getdate (), 0): 05 16 2006 AM
  2. Select convert (varchar (100), getdate (), 1): 05/16/06
  3. Select convert (varchar (100), getdate (), 2): 06.05.16
  4. Select convert (varchar (100), getdate (), 3): 16/05/06
  5. Select convert (varchar (100), getdate (), 4): 16.05.06
  6. Select convert (varchar (100), getdate (), 5): 16-05-06
  7. Select convert (varchar (100), getdate (), 6): 16 05 06
  8. Select convert (varchar (100), getdate (), 7): 05 16, 06
  9. Select convert (varchar (100), getdate (), 8): 10:57:46
  10. Select convert (varchar (100), getdate (), 9): 05 16 2006 10: 57: 46: 827am
  11. Select convert (varchar (100), getdate (), 10): 05-16-06
  12. Select convert (varchar (100), getdate (), 11): 06/05/16
  13. Select convert (varchar (100), getdate (), 12): 060516
  14. Select convert (varchar (100), getdate (), 13): 16 05 2006 10: 57: 46: 937
  15. Select convert (varchar (100), getdate (), 14): 10: 57: 46: 967
  16. Select convert (varchar (100), getdate (), 20): 10:57:47
  17. Select convert (varchar (100), getdate (), 21): 10:57:47. 157
  18. Select convert (varchar (100), getdate (), 22): 05/16/06 10:57:47 AM
  19. Select convert (varchar (100), getdate (), 23 ):
  20. Select convert (varchar (100), getdate (), 24): 10:57:47
  21. Select convert (varchar (100), getdate (), 25): 10:57:47. 250
  22. Select convert (varchar (100), getdate (), 100): 05 16 2006 AM
  23. Select convert (varchar (100), getdate (), 101): 05/16/2006
  24. Select convert (varchar (100), getdate (), 102): 2006.05.16
  25. Select convert (varchar (100), getdate (), 103): 16/05/2006
  26. Select convert (varchar (100), getdate (), 104): 16.05.2006
  27. Select convert (varchar (100), getdate (), 105): 16-05-2006
  28. Select convert (varchar (100), getdate (), 106): 16 05 2006
  29. Select convert (varchar (100), getdate (), 107): 05 16,200 6
  30. Select convert (varchar (100), getdate (), 108): 10:57:49
  31. Select convert (varchar (100), getdate (), 109): 05 16 2006 10: 57: 49: 437am
  32. Select convert (varchar (100), getdate (), 110): 05-16-2006
  33. Select convert (varchar (100), getdate (), 111): 2006/05/16
  34. Select convert (varchar (100), getdate (), 112): 20060516
  35. Select convert (varchar (100), getdate (), 113): 16 05 2006 10: 57: 49: 513
  36. Select convert (varchar (100), getdate (), 114): 10: 57: 49: 547
  37. Select convert (varchar (100), getdate (), 120): 10:57:49
  38. Select convert (varchar (100), getdate (), 121): 10:57:49. 700
  39. Select convert (varchar (100), getdate (), 126): 2006-05-16t10: 57: 49.827
  40. Select convert (varchar (100), getdate (), 130): 18 ???? ?????? 1427 10: 57: 49: 907am

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.