Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

time-frame calculation

Former Member
0 Likes
386

Hi all,

I want to know if a date lies within a given time-frame (marked by end date).

The problem is, that the user can give the check time frame in days, weeks, months or jears.

The calculation is actually similar to the best before date calculation in Material Master.

But how do I calculate with these units.

Greetings Fred

1 ACCEPTED SOLUTION
Read only

christian_wohlfahrt
Active Contributor
0 Likes
341

Hi Fred!

First you should convert your input into a date or a number of days. Here a case on the input type should help (if type = weeks, then multiply input * 7...)

With the number of days you can calculate your ending date (e.g. end_date = start_date + l_days). Then a simple if p_date > start_date and p_date < end_date. should do the job.

Regards,

Christian

1 REPLY 1
Read only

christian_wohlfahrt
Active Contributor
0 Likes
342

Hi Fred!

First you should convert your input into a date or a number of days. Here a case on the input type should help (if type = weeks, then multiply input * 7...)

With the number of days you can calculate your ending date (e.g. end_date = start_date + l_days). Then a simple if p_date > start_date and p_date < end_date. should do the job.

Regards,

Christian