About date format conversion functions in MySQL Query

Source: Internet
Author: User

The UNIX_TIMESTAMP () and UNIX_TIMESTAMP (date) functions are used to convert dates in MySQL queries. The following describes how to use the date Format Conversion Function in MySQL queries, for your reference.

If no parameter is called, a Unix timestamp ('2017-01-01 00:00:00 'seconds after GMT) is returned as an unsigned integer. If you use date to call UNIX_TIMESTAMP (), it will return the parameter value in the form of the number of seconds after '2017-01-01 00:00:00 'GMT. Date can be a DATE string, a datetime string, a TIMESTAMP, or a number in the YYMMDD or YYYMMDD format of the local time.

Mysql> SELECT UNIX_TIMESTAMP ();

-> 882226357

Mysql> SELECT UNIX_TIMESTAMP ('2017-10-04 22:23:00 ');

-> 875996580

When UNIX_TIMESTAMP is used in the TIMESTAMP column, the function returns an internal timestamp value without any implicit conversion of "string-to-Unix-TIMESTAMP. If you pass an overflow date to UNIX_TIMESTAMP (), it returns 0, but note that only the basic range check will be executed (year from 1970 to 2037, month from 01 to 12, from 01 to 31 ).

The preceding section describes the Date Format Conversion Function in MySQL query.


 

Optimization instance for MySQL random Query

MySQL query cache Variables

Mysql Key_buffer_size parameter settings

Set the maximum number of connections on the MySQL server

Mysql multi-Table query implementation

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.