In SQL Server, get the time in the 'yyyy-MM-DD 'format

Source: Internet
Author: User

CodeInstance:

Select Convert ( Varchar ( 10 ), Getdate (), 121 ) -- Do not set the time To 2002-01-01
Select Convert ( Varchar ( 10 ), Getdate (), 120 ) -- Do not time 2002-1-1
Select Convert ( Char ( 8 ), Getdate (), 112 ) -- 20020101
Select Convert ( Char ( 8 ), Getdate (), 108 ) -- 06:05:05

 

Standard:
1 101 us mm/DD/YYYY
2 102 ANSI yy. Mm. dd
3 103 UK/French dd/mm/yy
4 104 German dd. mm. yy
5 105 Italian DD-mm-yy
6 106-dd mon YY
7 107-mon DD, YY
8 108-hh: mm: SS
9 or 109 (*) Default Value + millisecond mon dd yyyy hh: MI: SS: mmmam (or pm)
10 110 US mm-dd-yy
11 111 YY/MM/DD in Japan
12 112 ISO yymmdd
13 or 113 (*) European default value + millisecond dd mon yyyy hh: mm: SS: Mmm (24 h)
14 114-hh: MI: SS: Mmm (24 h)
20 or 120 (*) ODBC specification yyyy-mm-dd hh: mm: ss [. fff]
21 or 121 (*) ODBC specification (with millisecond) yyyy-mm-dd hh: mm: ss [. fff]
126 (***) iso8601 yyyy-mm-dd thh: mm: SS: Mmm (without spaces)
130 * Kuwait dd mon yyyy hh: MI: SS: mmmam
131 * Kuwait dd/mm/yy hh: MI: SS: mmmam

 

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.