I have an input column and its datatype is integer. the source data is in the format of '20100823'.It means 2010(Year),08(month),23(Date).
My question is if the input column is in the last four months then it is X and if not then it is Y. Here we need to consider the year also.
If the input column is in the last four months then X then Y
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 21
- Joined: Mon Jul 12, 2010 2:05 am
- Location: India
Code: Select all
svYYYY_MM=DsJobStartTimestamp[1,7]
svYear=svYYYY_MM[1,4]
svMon=svYYYY_MM[6,2]
inp='20100823'
svInpYear=inp[1,4]
svInpMon=inp[5,2]
If (svYear - svInpYear)*12 + svMon - svInpMon <= 4 Then 'X' Else 'Y'
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 21
- Joined: Mon Jul 12, 2010 2:05 am
- Location: India
-
- Participant
- Posts: 21
- Joined: Mon Jul 12, 2010 2:05 am
- Location: India