MySQL part of the date taken

Source: Internet
Author: User
Tags month name

Date_format (Date,format)

  

Formats the date value according to the format string. The following modifiers can be used in the format string:%M month name (January ... December)%W week name (Sunday ... Saturday)%d The date of the month with English prefixes (1st, 2nd, 3rd, etc.). )%Y year, number, 4-digit%Y year, number, 2-bit%a abbreviated weekday name (Sun ... Sat)%d days in the month, number (00 ... %e number of days in the month, number (0 ... %m months, numbers (01 ... %c month, number (1 ... %b Abbreviated month name (Jan ... DEC)%j Days of the year (001 ... 366)%H hours (00 ... %k hours (0 ...) %h hours (01 ...) %I) Hours (01 ... %l hours (1 ...) %i minutes, Numbers (00 ...) %r time, 12 hours (Hh:mm:ss [ap]m)%T time, 24 hours (hh:mm:ss)%s seconds (00 ... ()%s seconds (00 ... %p am or pm%w one days of the week (0=sunday ... 6=saturday)%u week (0 ... 52), here Sunday is the first day of the week%u week (0 ... 52), here Monday is the first day of the week with a text "%". All other characters are not interpreted as being copied into the results. Mysql> Select Date_format (' 1997-10-04 22:23:00 ', '%W%M%Y ');-> ' Saturday October 1997 ' Mysql> Select Date_format  (' 1997-10-04 22:23:00 ', '%h:%i:%s ');-> ' 22:23:00 ' mysql> select Date_format (' 1997-10-04 22:23:00 ', '%d%y%a%d%m%b  %j ');-> ' 4th Sat in Oct 277 ' mysql> Select Date_format (' 1997-10-04 22:23:00 ', '%H%k%I%r%T%s%w ');-> ' 22 In 10:23:00 PM 22:23:00 6 ' MySQL3.23,% is required before the format modifier character. In the earlier version of MySQL,% is optional. 

  

MySQL part of the date taken

Related Article

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.