PHP 与MYSQL、oracle的时间差距计算方法

来源:互联网 发布:淘宝怎么排名的 编辑:程序博客网 时间:2024/05/14 11:03
 

PHP
strtotime("1980-8-20 12:25:33")-strtotime("1997-1-23 6:04:56");//秒钟差距


MYSQL
Datediff("d",date1,date2)//两日期的天数差
"d" day   “m" month   "yyyy" year "h" hour "s"   second "ww" week
date1为开始时间
date2为结束时间

mysql的time_to_sec
select time_to_sec("1980-8-20 12:25:33")-time_to_sec("1997-1-23 6:04:56")//秒钟差距

oracle
round(to_number(sysdate-datetime))
round(to_number(end_date-start_date))- 消逝的时间(以天为单位)
round(to_number(end_date-start_date)*24)- 消逝的时间(以小时为单位)
round(to_number(end_date-start_date)*1440)- 消逝的时间(以分钟为单位)

原创粉丝点击