PHP / CodeIgniter中的格式时间跨度 [英] Format timespan in PHP/CodeIgniter

查看:79
本文介绍了PHP / CodeIgniter中的格式时间跨度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个项目,该项目需要检查过去和现在的特定时间之间的时差,并仅以MINUTES输出diff。差异为2小时3分钟的示例。输出应为123(即2小时(120分钟)+ 3分钟)。

I am working on a project that needs to check time difference between a particular time in the past and now, and to output the diff in MINUTES only. Example if the Diff is 2hour 3min. the output should be 123 (ie 2hr(120 minutes) + 3min).

我使用了CodeIgniter timespan()功能,但只会返回2小时3分钟。
是否可以获取所需的输出?

I used CodeIgniter timespan() function, but it only returns something like 2hours 3minutes. Is there a way I can get the required output?

推荐答案

您需要类似的东西吗?

Do you need something like this ?

$tomorrow  = mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
$today = mktime(0, 0, 0, date("m"), date("d"),   date("Y"));

$minutesDiff = ($tomorrow - $today)/60;
echo $minutesDiff;

这篇关于PHP / CodeIgniter中的格式时间跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆