I came across something really weird today (pg 7.2). Check the following:
Unless I'm really overlooking something, the two functions should output exactly the same thing.
ergodb=# -- apparent bug:
ergodb=# select to_char(current_timestamp,'WW-D-YYYY') as "right",to_char(to_timestamp(to_char(current_timestamp,'WW-D-YYYY'),'WW-D-YYYY') ,'WW-D-YYYY') as "wrong";
right | wrong
22-3-2003 | 22-4-2003
I have more or less the same problem if I use WI instead of WW.
Anybody know about this? Is it a bug? Am I stupid?
Also I'd be curious whether anyone has, off the top of their head, a better idea how to represent "the beginning of the current week."