How to identify first Monday of the month

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
wilsonburazon
Participant
Posts: 3
Joined: Wed Aug 23, 2017 9:39 am

How to identify first Monday of the month

Post by wilsonburazon »

Is there any way in a transformer stage or any stage to know the specific day of a month? How do you know if the input is the first Monday of the month.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

what about

NextWeekdayFromDate
or
NthWeekdayFromDate
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

For first Monday of the month, try using WeekdayFromDate() to check if it is Monday along with checking if the day number of the month is <= 7.
Choose a job you love, and you will never have to work a day in your life. - Confucius
wilsonburazon
Participant
Posts: 3
Joined: Wed Aug 23, 2017 9:39 am

Post by wilsonburazon »

What if I have input records:
2017-08-04
2017-08-14
2017-08-21
2017-08-28

If I use WeekdayFromDate, all these records will return 1 (Monday). My goal is to find only the 2017-08-04.

Thanks for the reply tho.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

that is why he said weekday <= 7 or <8 if you prefer.

14,21, and 28 fail this conditional.
wilsonburazon
Participant
Posts: 3
Joined: Wed Aug 23, 2017 9:39 am

Post by wilsonburazon »

Cool. Got it! Thanks! :)
Post Reply