I found this handy little script that out puts the days and dates of the current week like this
16/08/2010 Monday 17/08/2010 Tuesday 18/08/2010 Wednesday 19/08/2010 Thursday 20/08/2010 Friday 21/08/2010 Saturday 22/08/2010 Sunday
PHP Code:
// set current date
$thisweek = date(m/d/Y);
// parse about any English textual datetime description into a Unix timestamp
$ts = strtotime($thisweek);
// calculate the number of days since Monday
$dow = date(w, $ts);
$offset = $dow - 1;
if ($offset < 0) $offset = 6;
// calculate timestamp for the Monday
$ts = $ts - $offset*86400;
// loop from Monday till Sunday
for ($i=0; $i<7; $i++, $ts+=86400){
print date(d/m/Y l, $ts) .
;
}
However I would like it to begin not on Monday ( unless today is Monday ) but on the day that we are in today and display the next six days. Everything that I touch messes up my years and Im back in 1959 :-) Any help will be greatly appreciated.
I found this handy little script that out puts the days and dates of the current week like this
16/08/2010 Monday 17/08/2010 Tuesday 18/08/2010 Wednesday 19/08/2010 Thursday 20/08/2010 Friday 21/08/2010 Saturday 22/08/2010 Sunday
PHP Code:
// set current date
$thisweek = date(m/d/Y);
// parse about any English textual datetime description into a Unix timestamp
$ts = strtotime($thisweek);
// calculate the number of days since Monday
$dow = date(w, $ts);
$offset = $dow - 1;
if ($offset < 0) $offset = 6;
// calculate timestamp for the Monday
$ts = $ts - $offset*86400;
// loop from Monday till Sunday
for ($i=0; $i<7; $i++, $ts+=86400){
print date(d/m/Y l, $ts) .
;
}
However I would like it to begin not on Monday ( unless today is Monday ) but on the day that we are in today and display the next six days. Everything that I touch messes up my years and Im back in 1959 :-) Any help will be greatly appreciated.
|
|
Search Webmaster Help and Solution
[RESOLVED] Display the days and dates of current week beginning todayRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
