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

PHP:以秒为单位的时差[重复]

This question already has an answer here:

  • How to calculate the difference between two dates using PHP? 32 answers

I would like to get the total number of seconds based from the given time, for example the following given data below:

$timein=04-01-2017 7:56:37 am;
$timeout=04-01-2017 5:15:17 pm;
$totalseconds= ?
</div>

PHP code demo

<?php
$time1=strtotime("04-01-2017 7:56:37 am");
$time2=strtotime("04-01-2017 5:15:17 pm");
echo $time2-$time1;

近期文章

  • JS / PHP,日期时间
  • 什么PHP版本仍然支持mysql_query()?
  • Ajax POST 500内部错误
  • PHP清除“回复:”邮件
  • 将自定义文本转换为html [关闭]
  • PHP:为什么printf(“%。2f”,0.02)输出0.024?为什么不是0.02?
  • 如何在按钮点击时多次播放声音?
  • 使用javascript提交表单,将其保存到$ _POST
  • 标题位置php
  • 管理当地时间和时区
  • PHP isset()函数返回false [关闭]
  • PHP中的Max函数在字符串上失败?
  • 使用getElementbyID()提交表单时无法执行任何操作
  • 使用php生成密码哈希
  • 从URL使用PHP到$ _GET [ID]
  • If / Else:在If语句中添加“Or”
  • php重定向脚本无法正常工作
  • too long
  • 将每个数组值返回到变量
  • INSERT INTO语句不会将数据发布到表[关闭]

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华