In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces how to use convert function to convert date format in SQLserver. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.
The default date field datetime format for the Chinese version of SQL Server is yyyy-mm-dd Thh:mm:ss.mmm for example: select getdate () sorts out the date format conversion methods that may be often used in SQL Server:
Examples are as follows: select CONVERT (varchar, getdate (), 2004-09-1211: 06:08 select replace (CONVERT (varchar, getdate ()),'-,'),':), 20040912110608 select CONVERT (varchar (12), getdate (), 111l) 2004-09-12 select CONVERT (varchar (12), getdate (), 112) 20040912 select CONVERT (varchar (12), getdate () 2004.09.12 select CONVERT (varchar (12), getdate (), 10110) 09 getdate (12) 2004 select CONVERT (varchar (12), getdate (), 103) 12) 09 select CONVERT (varchar (12), getdate (), 2004 select CONVERT (varchar (12), getdate (), 105) 12-09-2004 select CONVERT (varchar (12), getdate (), 106) 12 09 2004 select CONVERT (varchar (12), getdate (), 107) 09 12 2004 select CONVERT (varchar (12), getdate (), 2004) 11:06:08 select CONVERT (varchar (12), getdate (), 109109) 09 12 2004 1 select CONVERT (varchar (12), getdate (), 110) 09-12-2004 select CONVERT (varchar (12), getdate (), 113) 12 09 2004 1 select CONVERT (varchar (12), getdate (), 11411) 116purl 08.177 select getdate () result: 2003-12-28 16 select CONVERT 52select CONVERT 00.107 select convert (char (8)) Getdate () result: 20031228 select convert (char (8), getdate (), 108) result: 16:52:00 select convert (char (8), getdate (), 112)
The rules for date format are as follows: 1 101 US mm/dd/yyyy 2 102 ANSI yy.mm.dd 3 103 UK / France dd/mm/yy 4 104 Germany dd.mm.yy 5105 Italy dd-mm-yy 6 106-dd mon yy 7 107-mon dd Yy 8 108-hh:mm:ss-9 or 109 (*) default + millisecond mon dd yyyy hh:mi:ss:mmmAM (or PM) 10 110 US mm-dd-yy 11 111 Japan yy/mm/dd 12112 ISO yymmdd-13 or 113 (*) European default + 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 milliseconds) 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 about the format conversion of fields in Emaker and the operation code between fields Format conversion (read out) and format conversion (write) that can be added to the attribute The "field" position in the table field setting can also be flexibly added. For example: 'AF'+ID or ID+'/'+PWD, convert (varchar (50), F1), convert (int,%)-19110000 (readout) convert (char (8), convert (int,%) + 19110000) (write) to realize the total operation of rows, and so on. Adding:% system variable% is to call the system variable set in the Emaker system.
On how to use the convert function in SQLserver to convert the date format is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.