LoginSignup
0
3

More than 5 years have passed since last update.

任意の形式の曜日を取得する(PHP)

Posted at

PHP普段書かないのでよくわからんけども、やりたいことはできたのでメモ。

コード

<?php
$date = new DateTime('Asia/Tokyo');
print $date->format('Y-m-d H:i:s') . "\n";

$dayOfTheWeek = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');

print $dayOfTheWeek[$date->format('w')];
?>

出力結果

2017-09-19 10:53:00
Tue
0
3
2

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
3