'WEEK.TAG' with Sunday as start of week

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Sairam
Participant
Posts: 42
Joined: Tue Nov 11, 2003 1:09 pm

Post by Sairam »

Week Starting as Sunday and ending as Saturday

Oconv((Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD") ) - (Mod( Oconv(Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD"),"dw"),7) + 7) , "D-YMD[4,2,2]")

The above expression will provide the Previous Week Sunday
in YYYY-MM-DD format

Previous Week Saturday
Oconv((Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD") ) - (Mod( Oconv(Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD"),"dw"),7) + 7) + 6 , "D-YMD[4,2,2]")

The above expression will provide the Previous Week Saturday
in YYYY-MM-DD format

Use in the Transform function or as Activity Variable in the Sequencer .
Sairam
Participant
Posts: 42
Joined: Tue Nov 11, 2003 1:09 pm

Post by Sairam »

Get the Week Starting with Sunday

Oconv((Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD") ) - (Mod( Oconv(Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD"),"dw"),7) ) , "D-YMD[4,2,2]")

The above expression will provide the Week Starting with Sunday in YYYY-MM-DD format


Oconv((Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD") ) - (Mod( Oconv(Iconv(Oconv(date(), "D-YMD[4,2,2]") , "DYMD"),"dw"),7) ) + 6 , "D-YMD[4,2,2]")


The above expression will provide the Week Ending with Saturday in YYYY-MM-DD format


Thanks
Post Reply