Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Dream Web Host
July 31, 2005, 4:56 pm
rate this thread
Re: Automatic Billing
Don't know exactly what you are looking for, but one thing is sure, if you
can't handle it with date(), mktime() and strtime(), your thinking too
Different number of days in month is no problem, you can get the number of
days in february for example with
$february_first = mktime(0,0,0, 2,1,2005); // Creating a timestamp for
february 1st 2005.
date('t', $february_first); // the t parameter gives the number of days.
With mktime(0,0,0, $month,1,2005) you can create timestamps for billingdates
for each first of the month by altering the value of $month.
With strtotime() you can advance by days, months. I'm not sure if years, but
12 months should do it. Okay, you have billing date, and you need the next,
that's easy. Is it 1 month, 3 months or 12 months?
$next_billing_date = strtotime("+$months months", $current_billing_date);
//Where $months is either 1, 3 (as in a quarter) or 12 for entire year.
You should get started with those. Feel free to explain your problem further
to get a proper answer. :)
SETI @ Home - Donate your cpu's idle time to science.
Further reading at <http://setiweb.ssl.berkeley.edu/