Answers for "date and time difference in mysql"

SQL
1

mysql get date difference in hours

SELECT TIMESTAMPDIFF(HOUR, '2021-05-22 07:00:00', '2021-05-22 12:00:37') as time_diff_in_hours;
Posted by: Guest on September-30-2021
8

mysql date between two dates

-- With implicit CAST
SELECT * FROM my_table 
	WHERE my_date BETWEEN '2021-06-01 01:12:00' AND '2021-06-30 23:59:59';
-- is EQUIVALENT to
SELECT * FROM my_table 
	WHERE my_date >= '2021-06-01 01:12:00' AND my_col <= '2021-06-30 23:59:59';
Posted by: Guest on May-04-2021

Code answers related to "date and time difference in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language