socalnate Posted February 10, 2008 Share Posted February 10, 2008 The format is correct but it echos "4-2-2008" when todays date is "2-10-2008". Help very much appreciated...stumped. I updated my server time and rebooted my apache server but to no avail... Today's Date: <?php //----------------------------- $now = time(); $num = date("w"); if ($num == 0) { $sub = 6; } else { $sub = ($num-1); } $WeekMon = mktime(0, 0, 0, date("m", $now) , date("d", $now)-$sub, date("Y", $now)); //monday week begin calculation $todayh = getdate($WeekMon); //monday week begin reconvert $d = $todayh[mday]; $m = $todayh[mon]; $y = $todayh[year]; echo "$d-$m-$y"; //getdate converted day ?> Quote Link to comment https://forums.phpfreaks.com/topic/90398-time-echos-wrong-date-and-time/ Share on other sites More sharing options...
wildteen88 Posted February 10, 2008 Share Posted February 10, 2008 That code is correct as it displays the beginning date for the current week which is 4-2-2008 if you want the current date, just run date('d - m - Y'); Quote Link to comment https://forums.phpfreaks.com/topic/90398-time-echos-wrong-date-and-time/#findComment-463445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.