Database gets current time getdate ()

Source: Internet
Author: User

convert (nvarchar), count_time,121): Convert is a date conversion function, typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar, Char,varchar) 3 parameters of a function that are used when converting to each other,
The 1th parameter is the converted size, the 2nd is the field or function of the converted date, and the 3rd is the converted format, as follows:
  1. 0 | 0 or | mon dd yyyy hh:miam (or PM)
  2. 1 | 101 | Mm/dd/yy
  3. 2 | 102 | Yy-mm-dd
  4. 3 | 103 | Dd/mm/yy
  5. 4 | 104 | Dd-mm-yy
  6. 5 | 105 | Dd-mm-yy
  7. 6 | 106 | DD Mon yy
  8. 7 | 107 | Mon dd,yy
  9. 8 | 108 | Hh:mm:ss
  10. 9 | 9 or 109 | Mon dd yyyy hh:mi:ss:mmmmAM (or PM)
  11. 10 | 110 | Mm-dd-yy
  12. 11 | 111 | Yy/mm/dd
  13. 12 | 112 | Yymmdd
  14. 11| -or 113 | dd Mon yyyy hh:mi:ss:mmm (24-hour system)
  15. 14 | 114 | Hh:mi:ss:mmm (24-hour system)
  16. 15 | or | yyyy-mm-dd hh:mi:ss (24-hour system)
  17. 16 | or 121 | Yyyy-mm-dd hh:mi:ss:mmm (24-hour system)

Specific examples:
    1. SELECT CONVERT (varchar), GETDATE (), 0): 2006 10:57am
    2. SELECT CONVERT (varchar), GETDATE (), 1): 05/16/06
    3. SELECT CONVERT (varchar), GETDATE (), 2): 06.05.16
    4. SELECT CONVERT (varchar), GETDATE (), 3): 16/05/06
    5. SELECT CONVERT (varchar), GETDATE (), 4): 16.05.06
    6. SELECT CONVERT (varchar), GETDATE (), 5): 16-05-06
    7. SELECT CONVERT (varchar), GETDATE (), 6):
    8. SELECT CONVERT (varchar), GETDATE (), 7):,
    9. SELECT CONVERT (varchar), GETDATE (), 8): 10:57:46
    10. SELECT CONVERT (varchar), GETDATE (), 9): 2006 10:57:46:827am
    11. SELECT CONVERT (varchar), GETDATE (), ten): 05-16-06
    12. SELECT CONVERT (varchar), GETDATE (), one): 06/05/16
    13. SELECT CONVERT (varchar), GETDATE (), (+): 060516
    14. SELECT CONVERT (varchar), GETDATE (): 2006 10:57:46:937
    15. SELECT CONVERT (varchar), GETDATE (), +): 10:57:46:967
    16. SELECT CONVERT (varchar), GETDATE (): 2006-05-16 10:57:47
    17. SELECT CONVERT (varchar), GETDATE (), (+): 2006-05-16 10:57:47.157
    18. SELECT CONVERT (varchar), GETDATE (): 05/16/06 10:57:47 AM
    19. SELECT CONVERT (varchar), GETDATE (), max): 2006-05-16
    20. SELECT CONVERT (varchar), GETDATE (): 10:57:47
    21. SELECT CONVERT (varchar), GETDATE (), (+): 2006-05-16 10:57:47.250
    22. SELECT CONVERT (varchar), GETDATE (), (+): 2006 10:57am
    23. SELECT CONVERT (varchar), GETDATE (), 101): 05/16/2006
    24. SELECT CONVERT (varchar), GETDATE (), 102): 2006.05.16
    25. SELECT CONVERT (varchar), GETDATE (), 103): 16/05/2006
    26. SELECT CONVERT (varchar), GETDATE (), 104): 16.05.2006
    27. SELECT CONVERT (varchar), GETDATE (), max.: 16-05-2006
    28. SELECT CONVERT (varchar), GETDATE (), 106): 2006
    29. SELECT CONVERT (varchar), GETDATE (), 107): 2006
    30. SELECT CONVERT (varchar), GETDATE (), 108): 10:57:49
    31. SELECT CONVERT (varchar), GETDATE (), 109): 2006 10:57:49:437am
    32. SELECT CONVERT (varchar), GETDATE (), (+): 05-16-2006
    33. SELECT CONVERT (varchar), GETDATE (), 111): 2006/05/16
    34. SELECT CONVERT (varchar), GETDATE (), 20060516):
    35. SELECT CONVERT (varchar), GETDATE (), 113): 2006 10:57:49:513
    36. SELECT CONVERT (varchar), GETDATE (), (): 10:57:49:547
    37. SELECT CONVERT (varchar), GETDATE (), (+): 2006-05-16 10:57:49
    38. SELECT CONVERT (varchar), GETDATE (), 121): 2006-05-16 10:57:49.700
    39. SELECT CONVERT (varchar), GETDATE (), 126): 2006-05-16t10:57:49.827
    40. SELECT CONVERT (varchar), GETDATE (), ():?????????? 1427 10:57:49:907am
    41. SELECT CONVERT (varchar), GETDATE (), 131): 18/04/1427 10:57:49:920am

Example: Select Billdate,getdate (), convert (nvarchar (+), billdate,120), convert (nvarchar (+), GETDATE (), +) from Bill

(go) database Get current time getdate ()

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.