Home  >  Article  >  Database  >  Mysql计算时间间隔函数_MySQL

Mysql计算时间间隔函数_MySQL

WBOY
WBOYOriginal
2016-06-01 13:07:26903browse

bitsCN.com

#计算两个时间的间隔

#计算间隔天数

select TIMESTAMPDIFF(day,'2014-06-01',date(now()))

#计算间隔月数

select TIMESTAMPDIFF(month,'2014-01-01',date(now()))

#计算间隔年数

select TIMESTAMPDIFF(year,'2010-01-01',date(now())) bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn