且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

日期在php中的日期差异?

更新时间:2023-11-29 12:02:58

strtotime 会将您的日期字符串转换为 unix 时间戳.(自 Unix 时代以来的秒数.

strtotime will convert your date string to a unix time stamp. (seconds since the unix epoch.

$ts1 = strtotime($date1);
$ts2 = strtotime($date2);

$seconds_diff = $ts2 - $ts1;