LoginSignup
0
0

More than 5 years have passed since last update.

PHPで日付取得する方法、指定した日付から曜日を取得する方法

Last updated at Posted at 2019-03-07

日付取得には大きく2つの方法がある。

①date(): 欠点として、2038年1月19日 までしか使用できない。
②datetime

指定した日付から曜日を取得する方法

strtotimeで取得する
$date2=date('w',strtotime('20190307'));
echo $date2;

と入力すると、2019年3月7日の曜日が数値で出てくる。
【曜日に振り分けられている数値】
0:日
1:月
2:火
3:水
4:木
5:金
6:土

0
0
0

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
0
0