MySQL get the current date function and time format parameters detailed _mysql

Source: Internet
Author: User
Tags month name

MYSQL get current date and date format
Get system Date: Now ()
Format Date: date_format (date, format)
Note: Date: Time field
Format: Date formats

Back to system date, output 2009-12-25 14:38:59
Select Now ();
Output 09-12-25
Select Date_format (now (), '%y-%m-%d ');

Format date values according to the format string:

% S,%s two-bit numeric form of seconds (00,01, ...,
%I,%I Two-bit digital form (00,01, ...,)
%H Two-digit hours, 24 hours (00,01, ...,)
%H two digits Word form of the hour, 12 hours (01,02, ...,)
%k Digital form of hours, 24 hours (0,1, ...,)
%l Digital form of hours, 12 hours (1, 2, ...,)
%T 24 Hours of time form (hh:m M:SS)
%r 12-hour time (hh:mm:ss AM or hh:mm:ss pm)
%p am or PM
%w the name of each day of the week (Sunday, Monday, ..., Saturday)
%a each week Abbreviation for the name of the day (Sun, Mon, ..., Sat)
%d two digits indicates the number of days in the month (,...,)
%e The number of days in the month (1, 2, ...,)
%d The English suffix represents the number of days in the month (1st, 2nd, 3rd,...
%w The number of days in the week (0 = Sunday, 1=monday, ..., 6=saturday)
%j Three-digit number of days in the year (001, 002, ..., 366)
%u weeks (0, 1, 52), Where Sunday is the first day of the week
%u week (0, 1, 52), where Monday is the first day of the week
%m month name (January, February, ..., December)
%b abbreviated month name (January, Fe Bruary,...., December)
The month (1, 2, ...,)
%Y Four-digit year
%Y two-digit year (s) of the month (S.,., ...,)
that is represented by the two-digit number br>% Direct value "%"

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.