? function Gettimefromweek ($dayNum) { //$dayNum: 0-6 $curDayNum =date ("w"); if ($ Daynum> $curDayNum) $timeFlag = "Last"; ElseIf ($dayNum = = $curDayNum) $timeFlag = ""; //If you want to use week x else $timeFlag = "Next" on this week's Week X Else $timeFlag = "last";//this week X is not available this week x (let the data not be empty) $arryWeekDay = Array (' Sunday ', ' Monday ', ' Tuesday ', ' Wednesday ', ' Thursday ', ' Friday ', ' Saturday '); $timeStamp =strtotime ("$timeFlag". $arryWeekDay [$dayNum] "); return $timeStamp; } Echo Date ("Y-m-d L", Gettimefromweek (0)), echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (1)); echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (2)); echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (3)); echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (4)); echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (5)); echo "<br>"; echo Date ("Y-m-d L", Gettimefromweek (6)); echo "<br> ";