Analysis on mysql database formatting

Source: Internet
Author: User
Tags month name


About mysql database formatting analysis DATE_FORMA T (date, format) according to the format string format or date and Time Value date, return the result string. Www.2cto.com can use DATE_FORMAT () to format the DATE or DATETIME value to obtain the expected format. Format the date value in the format of % S and % s according to the format string ,..., 59) % I two-digit score ,..., 59) % H two-digit hour, 24 hours ,..., 23) % h, % I two-digit hour, 12 hours ,..., 12) % k number in the form of hour, 24 hours (0, 1 ,..., 23) % l hour in number format, 12 hours (1, 2 ,..., 12) % T 24 hour time format (h: m: s) % r 12 hour time format (hh: mm: ss AM or hh: mm: ss PM) % p AM or p m % W name of each day in a week (S u n d a y, Monday ,..., saturday) % a abbreviation of the name of each day in a week (Sun, Mon ,..., sat) % d indicates the number of days in a month (00, 01 ,..., 31) % e indicates the number of days in the month (1, 2 ,..., 31) % D indicates the number of days in a month (1st, 2nd, 3rd ,...) % w represents the number of days in a week (0 = S u n d a y, 1 = Monday ,..., 6 = Saturday) % j represents the number of days in the year (001,002 ,..., 366) % U Week (0, 1, 52), where Sunday is the first day of the week % u Week (0, 1, 52 ), monday is the first day of the week % M month name (J a n u a r y, February ,..., december) % B abbreviated month name (J a n u a r y, February ,..., december) % m double-digit month (01, 02 ,..., 12) % c indicates the month (1, 2 ,..., 12) % Y four-digit year % y two-digit year % direct value "%" select date_format (Date field, '% Y-% m-% D') as 'date' from test

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.