Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I calculate duedate from last duedate 2

Status
Not open for further replies.

benny4129

Programmer
Jan 19, 2007
12
US
Hi All

I have read the THREAD192-1277391 which explains how to add a week, a month, or a year to the present TODAY() date. I need to know how to add a week, 2 weeks, or a month to a duedate from the present month. For example if I have a credit card payment with a due date of 04/15/2007 but I make the payment on 04/03/2007, what code do I enter when I add the transaction payment to add a month to the due date of 04/15/2007.

Thanks Benny
 
Hi Benny,

NewDueDate = DATE(MONTH(OldDueDate)+1, DAY(OldNewDate), YEAR(OldNewDate))

Regards
 
I need to open a window from within my app based on the FIRST BUSINESS DAY OF THE MONTH. Example: May 1st was the 1st business day of the current month but in JULY for example, the 1st business day will be the SECOND (Monday), not the 1st (Sunday).
I've tried everything with Month(), Day(), etc. Any ideas of what the function should be?

Thanks,
 
Hi,

Try this ::

Code:
ChosenDate      DATE

ChosenDate = DATE(MONTH(TODAY(), 1, YEAR(TODAY()) ! based on current date - change if needed
IF ChosenDate % 7 = 0 ! Sunday
   ChosenDate += 1
ELSIF ChosenDate % 7 = 6 ! Saturday
   ChosenDate += 2
END

Regards
 
Hi!

Revise that to :

Code:
ChosenDate = DATE( MONTH(TODAY()), 1, YEAR(TODAY()) )

Missed some parenthesis.

Regards
 
Shankar:

Thanks for your quick suggestion. It makes a lot of sense. Have a good day.

cardan12
 
Hi Cardan,

Glad it worked for you. You may need to handle other public holidays on your own i.e. by storing them in a table and checking against that.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top