标签:datetime csdn sdn 函数 min time class 语法 sql
语法:
TIMESTAMPDIFF(interval,datetime_expr1,datetime_expr2)。
说明:
返回日期或日期时间表达式datetime_expr1 和datetime_expr2the 之间的整数差。其结果的单位由interval 参数给出。该参数必须是以下值的其中一个:
mysql> select TIMESTAMPDIFF(day,‘2012-08-24‘,‘2012-08-30‘); +----------------------------------------------+ | TIMESTAMPDIFF(day,‘2012-08-24‘,‘2012-08-30‘) | +----------------------------------------------+ | 6 | +----------------------------------------------+ 1 row in set (0.00 sec)
mysql> select TIMESTAMPDIFF(MINUTE,‘2012-08-24 09:00:00‘,‘2012-08-30 12:00:00‘); +-------------------------------------------------------------------+ | TIMESTAMPDIFF(MINUTE,‘2012-08-24 09:00:00‘,‘2012-08-30 12:00:00‘) | +-------------------------------------------------------------------+ | 8820 | +-------------------------------------------------------------------+ 1 row in set (0.01 sec)
mysql> select TIMESTAMPADD(MINUTE,8820,‘2012-08-24 09:00:00‘); +-------------------------------------------------+ | TIMESTAMPADD(MINUTE,8820,‘2012-08-24 09:00:00‘) | +-------------------------------------------------+ | 2012-08-30 12:00:00 | +-------------------------------------------------+ 1 row in set (0.00 sec)
来自:http://blog.csdn.net/zmxiangde_88/article/details/8011661
MySQL中TIMESTAMPDIFF和TIMESTAMPADD函数的用法
标签:datetime csdn sdn 函数 min time class 语法 sql
原文地址:http://www.cnblogs.com/dsitn/p/7151829.html