next day of the week logic problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Keychain

    next day of the week logic problem

    I'm stuck on what seems like should be a relatively easy problem.

    I'm creating a simple scheduler. From a form consisting of seven checkboxes
    (one for each day of the week) the user selects the days s/he would like an
    event to occur at the same time each day. The selections are stored in the
    database as a serialized array and periodically checked via cron to
    calculate how much time until the next event is to occur. For example let's
    say the user selects Monday, Wednesday & Saturday @ 1:00pm. So if the
    current day/time is Sunday @ 3:15pm, the next event will occur in 21:45.

    I know strtotime() will calculate the length of time, but my dilemma is how
    to determine the next day in the revolving sequence of days from the user's
    selections.

    All suggestions appreciated.

  • SrSilveira

    #2
    Re: next day of the week logic problem

    On 19 mar, 15:38, "Keychain" <some...@somewh ere.comwrote:
    I'm stuck on what seems like should be a relatively easy problem.
    >
    I'm creating a simple scheduler. From a form consisting of seven checkboxes
    (one for each day of the week) the user selects the days s/he would like an
    event to occur at the same time each day. The selections are stored in the
    database as a serialized array and periodically checked via cron to
    calculate how much time until the next event is to occur. For example let's
    say the user selects Monday, Wednesday & Saturday @ 1:00pm. So if the
    current day/time is Sunday @ 3:15pm, the next event will occur in 21:45.
    >
    I know strtotime() will calculate the length of time, but my dilemma is how
    to determine the next day in the revolving sequence of days from the user's
    selections.
    >
    All suggestions appreciated.
    like this?
    mktime (0, 0, 0, date("m") , date("d")+1, date("Y"));

    Comment

    Working...