SQL statement for mysql time operations

Source: Internet
Author: User

SQL statement for mysql time operations select * from mytest where (select DATEDIFF (now (), current) = 0); // SELECT OrderId, DATE_ADD (OrderDate, INTERVAL 2 DAY) AS OrderPayDateFROM Orders add 2 days to "OrderDate" and the result is 16:25:46. 635 SELECT OrderId, DATE_SUB (OrderDate, INTERVAL 2 DAY) AS OrderPayDateFROM Orders minus two days from "OrderDate" Result: 16:25:46. 635 the DATEDIFF () function returns the number of days between two dates. The date1 and date2 parameters are valid date or date/time expressions. Note: Only the date part of the value is involved in calculation. Select datediff ('2014-12-30 ', '2014-12-29') AS DiffDate result 1 select datediff ('2014-12-29 ', '2014-12-30') AS DiffDate result-1

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.