Re: Date_part & cast.
От | Tom Lane |
---|---|
Тема | Re: Date_part & cast. |
Дата | |
Msg-id | 29425.956447271@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Date_part & cast. (Christopher Sawtell <csawtell@xtra.co.nz>) |
Список | pgsql-sql |
Christopher Sawtell <csawtell@xtra.co.nz> writes: > btw, the days of the week start with Sunday = 1 Actually, date_part() seems to think Sunday = 0 ... > However I think this demonstrates a bug in the date functions. > chris@berty:~ > cal 11 1927 # In which I trust. > November 1927 > Su Mo Tu We Th Fr Sa > 1 2 3 4 5 > 6 7 8 9 10 11 12 > 13 14 15 16 17 18 19 > 20 21 22 23 24 25 26 > 27 28 29 30 > template1=# select date_part( 'dow', date '19271124' ); > date_part > ----------- > 4 > (1 row) > template1=# select date_part( 'dow', date '19271125' ); > date_part > ----------- > 5 > (1 row) > template1=# select date_part( 'dow', date '19271126' ); > date_part > ----------- > 0 > (1 row) > template1=# select date_part( 'dow', date '19271127' ); > date_part > ----------- > 1 > (1 row) Odd. I get 4,5,6,0, just like it should be. I am thinking you may be seeing some problem associated with a daylight-savings transition or some such info that Postgres gets from the local operating system. A lot of variants of Unix have pretty unreliable timezone tables for dates before 1970. Might want to check what your local tztab has for 1927. I'm running on HPUX 10.20 ... and am in EST5EDT time zone ... what about you? regards, tom lane
В списке pgsql-sql по дате отправления: