MySQL gets the current date and formatting

Source: Internet
Author: User
Tags month name

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

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

Format the date value according to the format string:

% s,%s two-digit seconds (00,01, ..., ()
%I,%I two-digit (00,01, ..., ())
% h two-digit hours, 24 hours (00,01, ..., two)
%H, in digital form Hours, 12 hours (01,02, ..., 2)
%k Digital form of hours, 24 hours (0,1, ..., 24)
%l Digital form of hours, 12 hours (1,, ...), and
% T in time form (HH:MM:SS) Br>%r 12-hour time format (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 is abbreviated for the name of each day of the week (S UN, Mon, ..., Sat)
%d two digits indicates the number of days in the month (XX,,...,)
%e number of days in the month (1, 2, ..., +)
% d The English suffix indicates 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 Week (0, 1, 52), where S Unday 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, February ,...., December)
%m Two-digit month (two)
%c number represents the month (1, 2, ....)
%Y Four-digit year
%Y the year
% direct value of the number represented by the-digit % "

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.