Summary of using the UNIX_TIMESTAMP function in MySQL

Source: Internet
Author: User

In MySQL, The UNIX_TIMESTAMP function is used. In MySQL, The UNIX_TIMESTAMP function has two types for calling. 1. No parameter call: UNIX_TIMESTAMP (). Return Value: example of the number of seconds difference from '2014-01-01 00:00:00 'to the current time: SELECT UNIX_TIMESTAMP () => 1970 2 has a parameter call: UNIX_TIMESTAMP (date) here, date can be a DATE string, a datetime string, a TIMESTAMP, a local time in the YYMMDD or YYYMMDD format. The return value is: example of the difference in seconds between '2017-01-01 00:00:00 'and the specified time: www.2cto.com DATE string format: (DATE type) SELECT UNIX_TIMESTAMP ('2017-06-08 ') => 1339084800 SELECT UNIX_TIMESTAMP (CURRENT_DATE () => 1339084800 note: the return value of CURRENT_DATE () is the same as that of a DATE string in the following formats: SELECT UNIX_TIMESTAMP ('20140901 '); SELECT UNIX_TIMESTAMP ('2017-6-8 '); SELECT UNIX_TIMESTAMP ('2017-06-08'); the result is: 2012 DATETIME string format: (combination type of date and time) SELECT UNIX_TIMESTAMP ('2017-06-08 10:48:55 ') => 2012 SELECT UNIX_TIMESTAMP (NOW () => 1339123415 note: the return value of NOW () is a DATETIME string format author MarcoFly

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.