1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

曜日を取得する方法

Last updated at Posted at 2022-03-20

・曜日を取得する方法

コード

<?php
$week_name = ['日', '月', '火', '水', '木', '金', '土'];
date_default_timezone_set('Asia/Tokyo');
$week = date('w');
echo "今日は、$week_name[$week]曜日です";

date_default_timezone_set('Asia/Tokyo'); で日本時間に設定

date('w')で曜日の番号を取得(0:日~6:土)

0:日~6:土に応じた配列を用意

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?