MySQL Time type summary and common time function

Source: Internet
Author: User

Date Time and type

Common date and time types

Bytes

Year 1 represents the range of years values: (1901----2155)

Date 4 is the date of year and month, for example: 2018-03-09 value range: 1000-01-01 to 9999-12-31

Time 3 indicates a value range of seconds and minutes 835:59:59 838:59:59

Dateime 8 represents a combination of date and time, and seconds and minutes: 1000-01-01 00:00:00 9999-12-31 23:59:59

Timestamp 4 means days and seconds

Common time functions

Now () Returns the current date and time
Curdate () Returns the current date
Curtime () Returns the current time
DATE () Extract date part of date or date/time expression
EXTRACT () Returns a separate part of the date/time Press
Date_add () Add a specified time interval to a date
Date_sub () Subtract a specified time interval from a date
DATEDIFF () Returns the number of days between two dates
Date_format () Display Date/time in a different format

MySQL Time type summary and common time function

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.