Need someones help who is good with date functions...

I am building a drip feed into my blog management software…

So you load up articles and it drips them out over x amount of days…

What gets submitted is date in this format 11/16/2011 (month/day/4 digit year) also the amount of time to drip (2-30 days)

So I would like it to pick the date out the amount of drip days selected and then randomly pick dates in between to post…

I think this may be easier converting to unix timestamp and then converting back for the database insertion…? Not sure…

After that it would randomlly select an hour, minute and second (although that should be easy) (ie rand(0,24) rand(0,60) rand(0,60) etc…

[php]//variables in
$orderdate //(date inputed from user ie 10/15/2011)
$dripfeed //(number between 2-30 inclusive submitted by user ie 2)

$dateadd = rand(1,$dripfeed);

list($month1,$day1,$year1)=explode("/",$orderdate);
$orderdate2 = mktime(0,0,0, $year1, $month1, $day1+$dateadd);
$orderdate3 = date(“Y-m-d”, $orderdate2);

$finaldate = $orderdate3 . " " . rand(0,24) . “:” . rand(0,60) . “:” . rand(0,60);[/php]

Should get a date 1 or 2 days plus what was submitted with random hours, minutes, seconds… this format

2011-10-15 10:34:12

It seems to break at the +$dateadd but im not sure how to do that line correctly…

Sponsor our Newsletter | Privacy Policy | Terms of Service