Convert using the convert function...

Source: Internet
Author: User
Add convert conversion to the query... Convert (varchar (10), field name, conversion format) such as selectuser_id, convert (varchar (10), date, 11) asdatefromtb_user conversion format: 0 or 100 monthddyyyyhh: miAMPM1mmddyy2yy. mm. dd3ddmmyy4dd. mm. the yy5dd-mm-yy6ddmonthyy adds convert conversion in the query...
Convert (varchar (10), field name, conversion format)

For example:
Select user_id, convert (varchar (10), date, 11) as date from tb_user

Conversion format:
0 or 100 month dd yyyy hh: miAMPM
1 MM/dd/yy
2 yy. mm. dd
3 dd/mm/yy
4 dd. mm. yy
5 dd-mm-yy
6 dd month yy
7 month dd, yy
8 hh: mi: ss
9 or 109 month dd yyyy hh: mi: ss: mmmAMPM
10mm-dd-yy
11 yy/mm/dd
12 yymmdd
101/dd/yyyy
102 yyyy. mm. dd
103 dd/mm/yyyy
104 dd. mm. yyyy
105 dd-mm-yyyy
106 dd month yyyy
107 month dd, yyyy
108 hh: mi: ss
110mm-dd-yyyy
111 yyyy/mm/dd
112 yyyymmdd

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.