Calculation of time gap between PHP, MySQL, and Oracle

Source: Internet
Author: User

PHP
Strtotime ("12:25:33")-strtotime ("6:04:56"); // second gap

MySQL
Datediff ("D", date1, date2) // The number of days difference between the two dates
"D" day "M" month "YYYY" year "H" Hour "S" second "ww" Week
Date1 is the start time
Date2 is the end time

Time_to_sec of MySQL
Select time_to_sec ("12:25:33")-time_to_sec ("6:04:56") // second gap

Oracle
Round (to_number (sysdate-datetime ))
Round (to_number (end_date-start_date)-elapsed time (in days)
Round (to_number (end_date-start_date) * 24)-elapsed time (in hours)
Round (to_number (end_date-start_date) * 1440)-elapsed time (in minutes)

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.