am 07.11.2005, um 14:47:35 +0100 mailte Robert Blixt folgendes: > > Hi, > > > I am currently extracting my weeks from a date like this.. > > SELECT INTO extractweek EXTRACT( week FROM ldate ); > > This works fine, except that this assumes (according > to ISO standard) that weeks starts with Monday. > > I need the weeks to start with Sunday instead, otherwise > I will not get the correct week. > > Is there a workaround for this?
Add 1 day to ldate. test=# select to_char('2005-11-05'::date+'1 day'::interval, 'IW'); to_char --------- 44 (1 row) test=# select to_char('2005-11-06'::date+'1 day'::interval, 'IW'); to_char --------- 45 (1 row) HTH, Andreas -- Andreas Kretschmer (Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net === Schollglas Unternehmensgruppe === ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq