Former Member

How to get 2 Dates of a specific day From a Pay period

Hi

I have a date range (Pay period). now from the start date i Need to find out both Dates of a specific day of that Pay period.

For Example If i know the date range is

01/06/2007 to 01/19/2007

Then I need to know what are the dates for both Saturdays.

Here it should be 01.06.2007 and 01.13.2007.

Message was edited by:

Anwarul Kabir

10|10000 characters needed characters exceeded

Related questions

Former Member
Posted on Oct 22, 2007 at 03:51 PM

If I understand correctly...

The simple solution would be just to add 7 to lower date. In your case 01/06/2007.

Or else

1) get the difference in no. if days between the 2 dates.

2) divide the number by 7

3) Ignore the decimal places.

4) Multiply the number you get by 7

5) Add this number to the lower date. <b>Thats the result</b>

Dont know if that sounds good to you.

Hope it helps.

Lokesh

Message was edited by:

Lokesh Aggarwal

10|10000 characters needed characters exceeded
• Former Member Former Member

yeah it works correctly if you add/subtract 7 from the date.

It takes care of month as well as leap year.

Just try date - 7 or date + 7.

It will work.

Reward if it helps.

Lokesh

• Posted on Oct 22, 2007 at 03:59 PM

Hi,

```PARAMETERS: P_START LIKE SY-DATUM,
P_END   LIKE SY-DATUM.

DATA: DAYS    TYPE I,
WEEKDAY LIKE DTRESR-WEEKDAY.

DAYS = P_END - P_START.

DO DAYS TIMES.
CALL FUNCTION 'DATE_TO_DAY'
EXPORTING
DATE    = P_START
IMPORTING
WEEKDAY = WEEKDAY.

IF WEEKDAY = 'Sat.'.
WRITE: / P_START.
ENDIF.

P_START = P_START + 1.

ENDDO.
```

Regards,

Ferry Lianto