LoginSignup
4
3

More than 5 years have passed since last update.

【PHP】週始まりが月曜日のFrom、Toの求め方

Last updated at Posted at 2013-08-20
<?php
$today = $_SERVER['REQUEST_TIME'];
$w     = (date('w', $today) + 6) % 7;
$from  = date('Y-m-d', $today - 86400 * $w);
$to    = date('Y-m-d', $today + 86400 * (6 - $w));
4
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3