Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Calculating a monthly renewal date
Old 07-12-2006, 12:04 AM Calculating a monthly renewal date
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Hi all,

Bearing in mind that months are different in length, how would you calculate a susbcriber's upcoming renewal date.

As an example of an account that was opened on May 31st, 2006.

1) The renewal date in July & August will be the 31st.
2) The renewal date in September will be the 30th.
3) The renewal date in February will be the 28th.

Obviously there are (very) long winded ways of doing this (which i could probably put together), but i was hoping to benefit from the brighter PHP programmers who know the more efficient method(s).
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 07-12-2006, 02:40 AM Re: Calculating a monthly renewal date
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
1. Make an array of matches between month number and days number in this month
[1] => 31
[2] => 28
...
[12] => 31
2. If the day of account opening is LAST day of the month, then just define the month of renewal and get the day number from the array. Else it will be the same day in next month. If the day number is greater than number of days in that month adjust it.

Do you still need the ready code for it?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 07-13-2006, 02:48 AM Re: Calculating a monthly renewal date
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Thanks.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Reply     « Reply to Calculating a monthly renewal date
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11340 seconds with 12 queries