我有当天的日期时间。我需要获得本周开始和结束的两个 unix 时间戳。如何使用 dateperiod 或 dateinterval 类?
最佳答案
$now = time();
$beginning_of_week = strtotime('last Monday', $now); // Gives you the time at the BEGINNING of the week
$end_of_week = strtotime('next Sunday', $now) + 86400; // Gives you the time at the END of the last day of the week
关于php - 获取本周的时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5449402/