LoginSignup
0

More than 3 years have passed since last update.

phpで月初、月末の日付をとる

Posted at

いつも忘れるので。

月初

date('Y-m-1 00:00:00, $targetUxTime);

月末

date('Y-m-t 23:59:59, $targetUxTime);

※tは月の日数なので必ず最終日になる

dateのformat

あれこれ

  • strtotimeで"first date of month"とかでもできるけどこれが一番スマート感

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