Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql date diff

SELECT DATEDIFF('2022-04-08',Date('2022-04-06 20:23:08')) as days,
TO_DAYS('2022-04-08') - TO_DAYS(date('2022-04-06 20:23:08')) as todays

//hours
SELECT TIMESTAMPDIFF(HOUR,NOW(),'2013-05-15 10:23:23')
   calculates difference in hour.(for days--> you have to define day replacing hour
 
PREVIOUS NEXT
Tagged: #sql #date #diff
ADD COMMENT
Topic
Name
9+4 =