1 (edited by papafrankc 2021-12-31 03:19:56)

Topic: Month with 30 or 31 days

Hi everyone, Happy New Year !
.
I've been  working with dates and have some questions.
What I have so far works as far as I've gone. Here's some examples:
.
Days   Period
1   = 1 day
7   = 1 week
14 = bi-weekly
30 = 1 month
60 = 2 months
90 = 3 months
180 = 6 months
365 = 1 year
.
I use the days to calculate when a service date is due.  As you've probably noticed my table doesn't allow for the differences in a month i.e. 28, 30 or 31 days.
.
Currently the user only picks the numbers (1,7,14,30...etc)  They don't see the meaning for each one as I have shown above.
I'd like to be able to put in a date say Jan 10, 2021. Then add 1 month to the date and have it return Feb 10, 2021, So if I put in a payment on Jan 10 and select 1 month, I'd like the next payment date to be Feb 10.
.
For my service dates, the 1-2 day discrepancies haven't been a big problem (although not very professional)
But I'm now working on some payments with payment due dates so this is more important that the dates are correct.
.
I'm wondering if there are any functions or procedures that address this in MVD?
.
Thanks, Frank

Re: Month with 30 or 31 days

Hi Frank - and a Happy New Year (almost) to you too,
A few different ways to approach it but you could try something like the attached.
I pinched it from an old project of mine and am just using it 'as is' so you might want to test it a bit more thoroughly!
If you have fewer payment terms, you could probably simplify it, but the principle is okay.
Regards,
Derek.

Post's attachments

Attachment icon due dates.zip 339.74 kb, 207 downloads since 2021-12-31 

Re: Month with 30 or 31 days

Derek,
Your example program works great.  I'm going to start working to adapt it to my application.  It takes care of the 30-31 day issue and that's been my biggest problem with due dates.

Thanks again for all your great help.
Frank