DB2 the syntax for calculating two date differences in a SQL statement
The end date is: 2015-10-10 11:30:00
Start Date: 2015-09-09 10:40:00
(1) Timestampdiff (8,char (end time-start time)) (overtime, seconds, zero) value of 744 hours
(2) (Days (end time)-days (start time)) *24 +hour (end time)-hour (start time) (No overtime seconds) value of 745 hours
(3) days (end date) The value of-days (start date) is 31 day
(4) Day (end date) The value of-day (start date) is 1 days
(5) Hour (end date)-hour (start date) value is 1 hours
(6) If the start date is 2012-09-09 10:00:00
Month (end date) The value of-month (start date) is 1 months
Syntax for calculating two date differences in an Oracle SQL statement
The end date is: 2015-5-27 11:20:47
Start Date: 2015-4-23 11:24:13
(1) Trunc (start time)-trunc (end time) value is 34 days (no overtime and seconds)
(2) Round (To_number (CAST (end date as date)-cast (start date as date)) has a value of 35 days (plus seconds/minute calculation to round)
(3) The value of round (To_number (CAST (end date as date)-cast (start date as date)) *24) is 816 hours (plus time and minute calculations are rounded)
(4) The value of round (To_number (CAST (end date as date)-cast (start date as date)) *24*60) is 48,957 minutes (plus time and minute calculations are rounded)
Syntax for calculating two time difference in DB2 and Oracle SQL statements