Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP "first date of this week" return last month

Tags:

date

php

Running

var_dump(new \DateTime('first day of this week'));

Returns the 1st of September

https://3v4l.org/GIPKR

Is this a bug, and is there any workaround?

enter image description here

like image 879
Petah Avatar asked Nov 19 '22 16:11

Petah


1 Answers

Please try below code :

var_dump(new \DateTime('monday this week'));
like image 117
Patrick R Avatar answered Jan 30 '23 09:01

Patrick R