Can any one give me some idea regarding how to calculate second and fourth saturdays i did based on time whenever i change system time it results in tuesdays insetad of saturdays.

Maybe check the examples at date() and time() functions at

Maybe example of your problem would help also.

The strtotime function is useful for this sort of thing. Here is a little routine that calculates the 2nd and 4th Saturdays in May (as an example):


	$wk = strtotime ("first saturday may 2009");
	if ($wk == false) {
		echo "<br>Not able to interpret the string ";
	$sat2	= $wk + (3600*24*7);				// add seven days  (in seconds)

	$sat4	= $sat2 + (3600*24*14);				// add 14 days

	$wk2 = date ("Y-m-d",$sat4);
	echo $wk2;


yes strtotime function is perfect of time calculations.

For example

$today=date('Y-m-d');// for example today is 2009-04-06
$newdate=strtotime ($today);// converted to strtotime

$newdate1= $newdate+ (3600*24*7);	// add 7 days
$newdate2= $newdate+ (3600*24*14);	// add 14 days

$day= date ("D",$newdate1); // DAY after 7 days
$day2= date ("D",$newdate2); // DAY after 14 days

echo "after 7 days the Day will be.".$day;
echo "after 14 days the Day will be.".$day2;

I want to display second and fourth saturdays not the day after 7th and 14th days.

try it.


for($i=1; $i<=31; $i++)
$newdate=strtotime ($mydate);
$saturday= date("w",$newdate);//Numeric representation of the day of the week  . 0 (for Sunday) through 6 (for Saturday)
				echo "<br>my 2nd saturdays is--".$mydate;
				echo "<br>my 4th saturdays is--".$mydate;

I already tried this method but in different way but no results.

I already tried this method but in different way but no results.

i tried it at my end. please try it now.

try this code please. it will give you the 2nd and 4th Saturday. if you have any further issue please explain that :)

i have edited the code for you. please try and tell what happened?

Show us your code if there are problems with it.

Quick look the previous code should work.

Like i said should work using the date() and time() functions depending on what your requirements are?

Thank you so much for your help i got the answer.