I want to convert year-week (yyyyww) in Pig to yyyyMMdd to get the first date of a given week. This is what I am trying and getting weird output.
ToString(ToDate('20171102', 'yyyyMMdd'), 'yyyyww') as c1
returns 201744. Which means 02-Nov-2017 is in 44th week of the year 2017. But when I do other way round, the output is weird.
ToString(ToDate('201744', 'yyyyww'), 'yyyyMMdd')
returns 20161031. Which says that the first date of 44th week of the year 2017 is 31-Oct-2016.
What am I doing wrong here?