views:

68

answers:

1

I need a function that takes an ISO week and an ISO year as parameter and returns the next ISO week and year (and a function that returns the previous ISO week/year).

Is there an existing function that I could use for that in PHP?

+1  A: 

So answer for 4 day so i give it a shot:

<?php

// Start with Timstamp 0, else the seconds might be off
$x = new DateTime("1970-01-01 00:00:00");
$x->setISODate(2010, 2);
echo $x->format("Y-m-d H:i:s"); // 2010-01-11 00:00:00

$x->modify("+1 week");

echo $x->format("Y-m-d H:i:s"); // 2010-01-18 00:00:00

// Now for the next ISO Week
echo $x->format("Y W"); // 2010 03

Hope that helps, else let me know :)

edorian