date functions
Posted: Sat Sep 02, 2006 11:21 pm
ok, im about to create a script that send's bills to my customers atuomatically, but im having a little issue with the dates. My idea is to have a database that has a "payment_due" column and a "next_payment" column. Then have a cron run the script every day. And the script will obviousally check to see that if todays date is the same as the date in the payment_due column and if it is it will send the email, and create a new payment_due value and a next_payment value in the database that is dependent on the payment cycle. (every month, 3 months ect...)
My issue is creating the next_payment date.
The first idea that came to mind was which takes care of the current date, but what about the next payment? So then i thought of doing something like but not every month has 4 weeks of 7 days, so that would cause an error down the line. My final idea was to do this which i assume does work but i find that a little imtimidation as i have no idea what any of those numbers (0, 0, 0) mean and ii have no idea how 1157169600 means September 02, and php.net dosnt do a really good job explaining it, anyone care to offer some input?
My issue is creating the next_payment date.
The first idea that came to mind was
Code: Select all
$date = date('d m');Code: Select all
$nextMonth = time() + (4 * 7 * 24 * 60 * 60);
$date = date('d m', $nextMonth);Code: Select all
$nextMonth = mktime(0, 0, 0, date("d"), date("m")+1));