Trouble Converting Dates
От | Kate Collins |
---|---|
Тема | Trouble Converting Dates |
Дата | |
Msg-id | 3A08397F.D2668498@wsicorp.com обсуждение исходный текст |
Список | pgsql-sql |
Hi I am running postgres 7.02 on Linux and I am having trouble converting a character string to a date using the "to_date" function. For example: select to_char( to_date( '001112', 'YYMMDD'), 'YYYYMMDD');to_char ----------00001112 In other words it is defaulting to the year 0 (actually year 1 BC, since there is no year 0) instead of 2000. Now I run the equivalent select statement on Oracle, and I get: select to_char( to_date( '001112', 'YYMMDD'), 'YYYYMMDD') from dual; TO_CHAR(TO_DATE('001112','YYMMDD'),'YYYYMMDD') --------------------------------------------------------------------------- 20001112 Which is what I expect. Is "YY" suppose to default to the current century or is this an Oracle'ism? I looked in my Postgres documents for a table describing the Date conversion strings, and could not find one. Is there a reference some one can direct me to? BTW, on postgres, when I try: select to_char( to_date( '20001112', 'YYYYMMDD'), 'YYYYMMDD'); I get the error: "ERROR: Unable to convert timestamp to date" Thanks, Kate -- ================================================= Katherine (Kate) L. Collins Senior Software Engineer/Meteorologist Weather Services International (WSI Corporation) 4 Federal Street Billerica, MA 01821 EMAIL: klcollins@wsicorp.com PHONE: (978) 670-5110 FAX: (978) 670-5100 http://www.intellicast.com
В списке pgsql-sql по дате отправления: