Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

timestamp difference sql

This function in MySQL is used to "return a value after subtracting a DateTime expression from another".
#TIMESTAMPDIFF(unit,expr1,expr2)

unit- It denotes the unit of the result.
        MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR
Exp1- First date or DateTime expressions.
Exp2- Second date or DateTime expressions.

select TIMESTAMPDIFF(month,'2022-06-14','2022-06-28') as MONTHDIFF
 
PREVIOUS NEXT
Tagged: #timestamp #difference #sql
ADD COMMENT
Topic
Name
3+2 =