Strtotime mystery

how is this possible? or better still - how do I fix this?
it’s a complete mystery to me!

$cal_date gives expected result
$calendar_date gives the same date over and over
$calendar_date is direct construct of $cal_date !

I’m going nuts !!

while (list($key, $value) = each ($events[$i]))
{
$start_date = $schedule_details[$value][‘0’];
$every = $schedule_details[$value][‘1’];
echo “<br>”.$start_date;
echo “<br>”.$every;
$cal_date = $year.$month.$i;
echo “<br>”.$cal_date;
$calendar_date = date(‘Y-m-d’, strtotime($cal_date));
echo “<br>”.$calendar_date;
$datediff = $start_date - $calendar_date;
$fulldays = floor($dateDiff/(606024));
echo “<br>”.$fulldays ." days diff";
}

below is output, it’s a calendar.

2010-03-14
14
201031
2010-03-05
0 days diff

2010-03-08
7
201032
2010-03-05
0 days diff

2010-03-16
14
201033
2010-03-05
0 days diff

201031

Why don’t you make that a proper date like 2010-03-01 instead of hoping strtotime knows what you want.
Seems 2010XX will just give todays date (where xx are numbers)

thanks hash,

I’m trying to grab the day# the calendar is running at the moment.
$i is my little counter of the day# going by. not sure how to define it as always 2 positions/places. can you help?

2010-3-1 will also work

thanks again hash.

are you saying if I can get $cal_date expressed like 2010-3-1, then strtotime will understand? yes or no please.

PLUS…
the bottom line here is I think I have to get $start_date and $calendar_date to play together nice so I can do the $datediff thing. am I going about this the hard way?

[QUOTE=m300zx;4530644]thanks again hash.

are you saying if I can get $cal_date expressed like 2010-3-1, then strtotime will understand? yes or no please.

YES!

thanks hash.

hope datediff is more cooperative :slight_smile:

Why… while (list($key, $value) = each ($events[$i])
Why not…foreach ( $events[ $i ] as $key =&gt; $value )

don’t know why… in a rush, and rehashing old code that works. strtotime problem is fixed now. will have a closer look at your question this weekend.

thanks for your thoughts logic!