Code sur écran d'ordinateur

PHP: Create a date/ timestamp with strtotime by setting the time

Everyone knows the strtotime function.
With it, for example, we can retrieve the date of 2 weeks ago,

strtotime ('-2 week');

or a year ago

strtotime ('-1 year');

What is interesting is that you can retrieve the date of 2 weeks ago while defining the time, for example midnight

strtotime ('2 week midnight');

or noon:

strtotime ('-2 week noon');

the full list can be found at the following address here

Leave a comment