"Dream Web Host" <ro**********@b lueyonder.co.uk > kirjoitti
viestissä:11*** *************** ****@g49g2000cw a.googlegroups. com...
Hi,
I am creating a Web hosting billing program and require a script which
will output the date next month, obviously this can be difficult due to
different numbers of days in different months. It needs to be able to
differ between monthly payments, quarterly and also yearly.
Any tips?
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
complicated.
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_d ate = strtotime("+$mo nths months", $current_billin g_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.ber keley.edu/>
Soulman <et************ ****@5P4Mgmail. com>