Summary of usage of SQL convert conversion function
Source: Internet
Author: User
format:
CONVERT (Data_type,expression[,style])
Description: This style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)
When they are converted to each other.
Example: SELECT CONVERT (varchar), GETDATE (), () now
The results are:
Now
---------------------------------------
09/15/2001
The style number has the following meanings when converting time:
Copy CodeThe code is as follows:
Style (2-bit year) style (4-bit year) Input output format
0 Mon dd yyyy hh:miam (or PM)
1 101 American Mm/dd/yy
2 102 ANSI YY-MM-DD
3 103 English-French Dd/mm/yy
4 104 German Dd.mm.yy
5 105 Italian Dd-mm-yy
6 Mon dd yy
7 Mon Dd,yy
8 108 Hh:mm:ss
9 109 Mon dd yyyy Hh:mi:ss:mmmmAM (or PM)
10 110 American Mm-dd-yy
11 111 Japanese Yy/mm/dd
112 ISO YYMMDD
13 113 Euro Default DD Mon yyyy hh:mi:ss:mmm (24-hour system)
114 Hh:mi:ss:mmm (24-hour system)
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