TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) : TIMESTAMPDIFF : Date Time Functions MySQL TUTORIALS


MySQL TUTORIALS » Date Time Functions » TIMESTAMPDIFF »

 

TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2)


The unit for the result is given by the unit argument.

The unit should be one of the following values:

  1. FRAC_SECOND,
  2. SECOND,
  3. MINUTE,
  4. HOUR,
  5. DAY,
  6. WEEK,
  7. MONTH,
  8. QUARTER, or
  9. YEAR.
mysql>
mysql> SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
+------------------------------------------------+
| TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01') |
+------------------------------------------------+
|                                              |
+------------------------------------------------+
row in set (0.00 sec)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Date Time Functions
» TIMESTAMPDIFF