Sign in to follow this  
Followers 0
gcue

monthly - reset count

4 posts in this topic

#1 ·  Posted (edited)

i am trying to track down my monthly minutes for a calling plan i have.

everytime i enter X minutes into a script it deducts X amount from the grand total of 2000 (which i am alotted per month.)

my plan resets the minute count every 22nd of every month. in a perfect world, i can open the program every month on the 22nd, but what happens if i dont open it on that day? how can i tell the script to reset the count?

i was thinking the following:

track the day when it last resets. (write a date stamp in an ini file)

then

if @mday = 22 and _datediff($today, $last_reset) > 28 then RESET (rewrite last reset date)

but that will keep resetting trailing days if the month has more than 28 days

please help!

Edited by gcue

Share this post


Link to post
Share on other sites



The logic is:

If month_difference => 1 and current_date => 22 then RESET

Reset

{

write current month in your .ini

}


_____________________________________________________________________________

Share this post


Link to post
Share on other sites

sounds good!!!

many thanks =)

Share this post


Link to post
Share on other sites

Also remember about negative difference(January minus December = -11) or check a year too...


_____________________________________________________________________________

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0