我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

最快显示x天,x小时,分钟和秒

I have two dates in mysql,

I can get the difference(in seconds) by doing date1 - date2.

Now I need to show x days, x hours, x minutes, x seconds

If there are 0 days then it will simply be x hours, x minutes, x seconds.

So,

What is the best way to do this?

note: 3650 seconds will show as 1 hour, 0 minutes, 50 seconds.

So do i use modulus? or ...

This function will be helpful:

http://aidanlister.com/2004/04/making-time-periods-readable/

近期文章

  • Laravel - 使用不同的id进行唯一验证
  • 如何在PHP中使用curl -T / - upload-file和POST?
  • 可以不覆盖PHPUnit测试存根方法吗?
  • 具有会话登录表单的Mysqli和Php保持失败
  • Laravel 5.1只将url()函数链接到http
  • 如何从我的班级的另一个电话访问数据?
  • 为Drupal 7配置Nginx,递归目录?
  • 在页面API请求中包含相关的模型数据
  • Silverstripe自定义控制器数据/变量
  • 使用Sessions连接HTML,Javascript和PHP
  • 关于Wordpress get_the_title函数的混淆
  • 如何处理Doctrine 2验证的异常
  • 如何判断是否从fetch()调用了页面?
  • 我可以将post.php永久保存吗?
  • 使用mysql排序规则的安全问题/ sql注入?
  • 在PHP和JavaScript中将货币转换为十进制
  • 如何使用PHP检测图像上的圆形颜色
  • 将.rar文件解压缩到php中的特定目录
  • Swiftmailer - 两次发送邮件,没有任何内容
  • 为每个事件管理laravel 5日志的最佳方式

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华