Convert (varchar (10), field name, conversion format)

Source: Internet
Author: User

Convert (varchar (10), field name, conversion format)

Convert (nvarchar (10), count_time, 121)
Convert is a date conversion function, generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, Char, varchar)
The three parameters of the function used only during mutual conversion. The first parameter is the size of the converted function, the second parameter is the field or function of the date to be converted, and the second parameter is the conversion format.

The details are as follows:
0 | 0 or 100 | mon dd yyyy hh: miam (or pm)
1 | 101 | mm/DD/yy
2 | 102 | YY-mm-dd
3 | 103 | dd/mm/yy
4 | 104 | DD-mm-yy
5 | 105 | DD-mm-yy
6 | 106 | dd mon YY
7 | 107 | mon DD, YY
Eight | 108 | hh: mm: SS
9 | 9 or 109 | mon dd yyyy hh: MI: SS: mmmmam (or pm)
10 | 110 | mm-dd-yy
11 | 111 | YY/MM/dd
12 | 112 | yymmdd
11 | 13 or 113 | dd mon yyyy hh: MI: SS: Mmm (in 24-hour format)
14 | 114 | hh: MI: SS: Mmm (in 24-hour format)
15 | 20 or 120 | yyyy-mm-dd hh: MI: SS (in 24-hour format)
16 | 21 or 121 | yyyy-mm-dd hh: MI: SS: Mmm (in 24-hour format)

Time Comparison:

   Cast  (  '  1900  '     +  Time1  As     Datetime  )  >     Cast  (  '  1900-01-01 '     +     @ Begin    As     Datetime  ) 

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.