[PHP] Re: scheduler algorithm

2007-02-02 Thread frank
hmmm, a month period has 4*7 days e.g. then i can schedule on 31.3.07 a
month  period which will repeat itself on 30.4.07 and again on 30.5.07 even
though may has 31 days. i dont see no other logic if you take a week period
it same a week has always 7 days. how else would it make sense. the start
date += the period

fra*



bruce [EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
 hi...

 i'm creating a quick/dirty app for scheduling a function, based on the
user
 entering a start time/date, as well as a potential periodic timeframe.

 ie:
  the user enters-
   start time/date: 10:00am 01/10/07
 periodic monthly

 the idea is to be able to have a process start running on the start
 time/date, and then to repeat on a monthly basis on the same time/date. i
 can easily accomplish this for dates that are '1-28', but i'm looking for
 suggestions as to how to handle situations where the number of the start
 date, might be greater than the end date of the 'current month.

 in searching google, i haven't come up with many apps that handle this...

 thoughts/comments/etc...

 thanks.

 -bruce

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



Re: [PHP] Re: scheduler algorithm

2007-02-02 Thread Richard Lynch

You may want to look at what various databases will do for you with
date arithmetic.

E.g., You can type this in MySQL:

select date_add('2007-01-31', interval 1 month);

I'm not sure what it will answer, but you can type that. :-)

In Postgresql, it's more like:
select '1/31/2007'::date + '1 month'::interval;

but the point is that somebody else has already solved this most
likely, and you should definitely not try to re-invent the wheel on
this one.


On Fri, February 2, 2007 4:24 pm, frank wrote:
 hmmm, a month period has 4*7 days e.g. then i can schedule on 31.3.07
 a
 month  period which will repeat itself on 30.4.07 and again on 30.5.07
 even
 though may has 31 days. i dont see no other logic if you take a week
 period
 it same a week has always 7 days. how else would it make sense. the
 start
 date += the period

 fra*



 bruce [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]
 hi...

 i'm creating a quick/dirty app for scheduling a function, based on
 the
 user
 entering a start time/date, as well as a potential periodic
 timeframe.

 ie:
  the user enters-
   start time/date: 10:00am 01/10/07
 periodic monthly

 the idea is to be able to have a process start running on the start
 time/date, and then to repeat on a monthly basis on the same
 time/date. i
 can easily accomplish this for dates that are '1-28', but i'm
 looking for
 suggestions as to how to handle situations where the number of the
 start
 date, might be greater than the end date of the 'current month.

 in searching google, i haven't come up with many apps that handle
 this...

 thoughts/comments/etc...

 thanks.

 -bruce

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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