Page 2 of 2

Posted: Tue Dec 19, 2006 10:06 pm
by feyd
Hang on.. $frequencycurrent is what? A previous result? If so, keep the result from strtotime() in a separate variable. Pass that to strtotime() on the second iteration. Or rather always pass it, but for the initial run, set it to time().

Posted: Wed Dec 20, 2006 12:17 am
by Kieran Huggins
since the date is all screwed up in ddmmyy format, which neither sorts naturally nor is welcomed by any functions, you'll have to plug in a bit more code than that I'm afraid :-(

For the sake of space I'm going to make a reference to your long-ass-variable (which is fine, don't get me wrong!)

Code: Select all

$fc=&$frequencycurrent;

$fc = date('dmy',strtotime('+2 weeks',mktime(0,0,0,substr($fc,2,2),substr($fc,0,2),substr($fc,4,2))));
substr() returns substrings of your date format for month, day and year (in that order, which mktime() wants)

mktime() makes a unix timestamp out of those variables

strtotime() adds 2 weeks to it

finally date() turns it back into your strange date format.

It's kludgy but it works.

Cheers,
Kieran

Posted: Wed Dec 20, 2006 7:49 am
by iknownothing
that piece of code should be called a broom, did a great job of sweeping up my mess, cheers.