Date calculation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sampada
Forum Newbie
Posts: 1
Joined: Thu Jun 19, 2008 12:03 am

Date calculation

Post by sampada »

Hi
I need to calculate next payment date based on start payment date and mode of pament (i.e yearly, quarterly, half-yearly and monthly)

If the start payment is 2008-07-08 (Y-m-d) and mode of payment is half yearly than the next payment date would be 2009-01-08 .
For the next time, the next payment date would be start payment date and we need to calculate next payment date.

Same with other modes of payment(quarterly, yearly and monthly)

Is there any inbuilt function in Php for this? or may be is there any efficient way to perform this action

Any suggestions
Thanks
sampada
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Date calculation

Post by John Cartwright »

Heres a start,

Code: Select all

echo strtotime('2008-07-08', '+6 months');
sureshmaharana
Forum Commoner
Posts: 30
Joined: Thu Jul 03, 2008 4:20 am
Contact:

Re: Date calculation

Post by sureshmaharana »

Hi,

You can use this for half yearly:
$date = date('Y-m-d', strtotime("+6 Month"));

Regards,
Suresh Maharana
Post Reply