Hi there,
Don't really understand what you want...
> $timegiven = (...)
>
> $w=date("Y-W-w",$timegiven);
>
> Hi, i'm using the above, to get the YEAR, Week of the year, & the
> number of the day - in a week.. for a given date. This works..
>
> ...
> If i wanted to - Is it possible to easily change what day a
> week starts from ?
> Eg, Saturday to be the start of the week - or Wednesday ?
What would be the purpose of that? You still would want to produce the same
result, no? You don't want the script to come up with the anser 'tuesday'
instead of 'monday' generated from the UNIX timestamp, no?
If you really want to do that could do:
$DaysToChange = array("sunday", "monday", "tuesday", ...)
$DaystoChangeTo = array("monday", "tuesday", "wednesday", ...)
and then
str_replace($DaysToChange, $DaysToChangeTo, $w);
but the purpose still beats me. I trust that the outcome of the date()
function is correct.
For those religious fanatics* who really want to see a speciic week start on
let's say a monday instead of sunday then the weeknumber given in $w is only
one off on sunday (already increased by one), so then:
$Year, $Week, $Day = split($w, "-");
$Week = (($Day='sunday')?$Week-1:$Week);
$w = $Year."-".$Week."-".$Day;
will almost do the trick (unless January 1 is a sunday).
Marc
* not intended to be rude. Just that where to start counting is arbitrary
anyway, time is a sequence of days and nights from the beginning, and the
counter was set to '1' based on whatever thick book was in front of the guy
who decided about it...
------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~->
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/