php - Generating a date based on a weekinterval, a day, and an existing date -


i have database different workdates, , have make calculation generates more dates based on weekinterval (stored in database) , (in database stored) days on workdays occur. code following:

  • read first 2 workdates -> calculate weeks inbetween , save week interval
  • read workdates -> fill in days on workdate occurs , save in contract.
  • generate workdates next year, based on week interval.

the point is: each week week interval of 1, more days of week should saved workdate. i've used code this, doesn't work.

// last workdate's actdate. $workdate_date = $linked_workdate['workdate']['workdate_actdate']; // calculate new workdate's date $date = date("y-m-d", strtotime($workdate_date . "+" . $interval . " week"));  // if 'monday' filled in contract, calculate on day  // monday after last interval is. same each day, obviously. // days boolean. if ($contract['contract']['contract_maandag'] = 1){      $date = date("y-m-d", strtotime($date, "next monday")); } if ($contract['contract']['contract_dinsdag'] = 1){     $date = date("y-m-d", strtotime($date, "next tuesday"));            } // after this, save $date in database, works.  

here error get: strtotime() expects parameter 2 long, string given

i'm quite stuck right now, appreciated!

if ($contract['contract']['contract_maandag'] = 1){  if ($contract['contract']['contract_dinsdag'] = 1){ 

this won't work. you're doing assignment (=), it's true. want comparison (===). recommended (except required otherwise) use strict (===) comparison.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -