- time: documentation ( source)
- mktime: documentation ( source)
- date: documentation ( source)
- strtotime: documentation ( source)
<?php
echo date("H:i:s Y-m-d", time());
echo "\n";
$time = time();
echo date("H:i:s Y-m-d",(date('w', $time) == 1) ? mktime(0, 0, 0, date('j'), date('n')) : strtotime('last sunday', $time));