Application Development 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: 

time-frame calculation

Former Member
0 Kudos

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

christian_wohlfahrt
Active Contributor
0 Kudos

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

christian_wohlfahrt
Active Contributor
0 Kudos

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