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 5 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"とかでもできるけどこれが一番スマート感
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?