Peter verleg Peter verleg - 8 months ago 43
PHP Question

converting UNIX time stamp date to the Monday of that week

how can i convert a time stamp to Monday corresponding with that week?

1473750000 (Tue, 13 Sep 2016 07:00:00 GMT)

// coding magic

1473638400 (Mon, 12 Sep 2016 00:00:00 GMT )


To convert timestamps, you can use a PHP Function gmdate(). I already use this on some of my projects/sites.

$timestamp = strtotime("+1 hour"); //Uk Time
echo gmdate("H:i", $timestamp); //Hour:Minutes

For the other parts of gmdate(), check the PHP Manual.