>>>>> "Sreeni" == Sreeni Survi <sreenisurvi@gmail.com> writes:
Sreeni> Hi,
Sreeni> Below code has caused my data to be wiped off a table as my
Sreeni> where clause depends on the below returned value.
Sreeni> *select to_char(current_date - interval '5 weeks','IYYYWW') ;*
Sreeni> *201953*
That's because IYYY is intended for use with IW, not with WW. The output
is correct, it's the query that's wrong.
There are several different definitions of "week number", and IW is the
ISO week, with IYYY being the corresponding year. So 5 weeks ago, which
was Dec 31st 2018, was ISO week 1 of 2019, but in some other week
numbering systems, it was week 53 of 2018.
--
Andrew (irc:RhodiumToad)