MySQL Date_format () function

Source: Internet
Author: User

Definition and usage

The Date_format () function is used to display date/time data in different formats.

Grammar
Date_format (Date,format)

The date parameter is a valid day. format Specifies the date/time in which the output is formatted.

Detailed reference: http://www.w3school.com.cn/sql/func_date_format.asp

Example

The following script uses the Date_format () function to display different formats. We use now () to get the current date/time:

Date_format (now (), '%b%d%Y%h:%i%p ') Date_format (now (), '%m-%d-%y ') Date_format (now (), '%d%b%Y ') Date_format (now (), '% D%b%Y%t:%f ')

Output Result:

Dec 11:45 pm12-29-200829 Dec 0829 Dec 2008 16:25:46.635


MySQL Date_format () function

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.