RE: Re: Numerical Recipe - Scheduling Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hey shawn...

strtotime (or something similar) might just work

i'll always know the interval... which can be used to compute the nexttime,
which then becomes the next starttime...

i'm assuming there's an equally simple way to find the last day of a given
month if i choose that as an interval as well..

for my initial needs.. this might work.. until i free up time to actually
craft a more generic solution, independent of the underlying language/os..

thanks



for next month.. and the start

-----Original Message-----
From: Shawn McKenzie [mailto:nospam@xxxxxxxxxxxxx]
Sent: Friday, May 29, 2009 2:48 PM
To: php-general@xxxxxxxxxxxxx
Subject:  Re: Numerical Recipe - Scheduling Question


bruce wrote:
> Hi..
>
> Got a need to be able to allow a user to specify the frequency to run
> certain apps/processes.. I need to be able to have the user specify a
start
> Time, as well as a periodic frequency (once, hourly, daily, weekly...) as
> well as allow the user to specify every XX minutes...
>
> So i basically need to be able to determine when the future
> events/occurances are, based on the user input.
>
> I've searched the net for alogorithms dealing with scheduling and haven't
> come up with any php based solutions.. I've also looked at numerical
recipes
> and some other sources (freshmeat/sourceforge/etc..) with no luck..
>
> I have found an approach in another language that I could port to php..
But
> before I code/recreate this, I figured I'd see if anyone here has pointers
> or suggestions...
>
> Cron doesn't work for me, as it can run a process at a given time.. but it
> doesn't tell me when the next 'X' occurance would be...
>
> Thoughts/Comments..
>
> Thanks
>

This is confusing.  When and where do you need to "be able to determine
when the future events/occurances are"?  You need to display this after
the user schedules the app/process or an admin needs to login and see
this at any given time?

Regardless it is easy with the PHP time/date functions.  Once you've
collected and stored the start/stop times and interval, something
similar to:

$interval = "1 week";

$next = $start_time;
while ($next <= $end_time) {
	$next = strtotime("+$interval", $next);
	echo date(DATE_RFC822, $next) ."\n";
}


--
Thanks!
-Shawn
http://www.spidean.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux