Timestamp problems...wrong weeks.

Поиск
Список
Период
Сортировка
От Campano, Troy
Тема Timestamp problems...wrong weeks.
Дата
Msg-id 82C3FD729CFA504CA44E7D32BDED411F099C8792@lm-exmsg-07.lm.lmig.com
обсуждение исходный текст
Ответы Re: Timestamp problems...wrong weeks.  (Andrew Sullivan <ajs@crankycanuck.ca>)
Re: Timestamp problems...wrong weeks.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

Hello,

Im having a problem with timestamps in postgresql.

I run the following query to pull dates in this format:

WEEK/MONTH/YEAR

However the data says that April 28th 2004 was in week 4 of April and that April 29th 2004 was in week 5 of april.

This is incorrect.

This is causing my reports to print out incorrect data.

Do you know why this would happen? Am I doing something wrong?

--SQL CODE

SELECT

current_timestamp,

completion_date,

to_char(current_timestamp,'W/MM/YYYY'),

to_char(completion_date,'W/MM/YYYY')

FROM anna_onestop_database_t

WHERE to_char(current_timestamp,'MM/YYYY') = to_char(completion_date,'MM/YYYY')

AND upper(solution_provider) = 'N0050961' AND status LIKE 'Closed - Completed'

--RESULTSET

Timestamptz                          |completion_date    |to_char  |to_char

2004-04-29 14:29:47.289369-04|2004-04-28 11:40:35|5/04/2004|4/04/2004

2004-04-29 14:29:47.289369-04|2004-04-29 13:26:34|5/04/2004|5/04/2004

thank you!

Troy Campano

В списке pgsql-general по дате отправления:

Предыдущее
От: "Jon Pastore"
Дата:
Сообщение: Re: postgresql idle
Следующее
От: "Dann Corbit"
Дата:
Сообщение: Re: Arbitrary precision modulo operation