![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am not sure but i thought I read something of this problem and maybe its not a problem but my understanding. There are only 30 days in september however I can not seem to make a query that asks for october 1. |
|
proofduedate is time stamp with zone maybe this is the problem but I am a little lost. SELECT jobnumseq, proofduedate FROM jobs WHERE proofduedate BETWEEN to_timestamp('29 September 2003', 'DD Month YYYY') AND to_timestamp('31 September 2003 23:59', 'DD Month YYYY HH24:MI'); jobnumseq | proofduedate -----------+------------------------ 10080 | 2003-09-30 17:00:00-04 10081 | 2003-09-30 22:00:00-04 10082 | 2003-10-01 16:00:00-04 10074 | 2003-09-29 16:00:00-04 10077 | 2003-09-29 16:00:00-04 10078 | 2003-09-29 18:00:00-04 10079 | 2003-09-30 15:00:00-04 10083 | 2003-10-01 13:00:00-04 10084 | 2003-10-01 13:00:00-04 10085 | 2003-10-01 13:00:00-04 10086 | 2003-10-01 16:00:00-04 10087 | 2003-10-01 16:00:00-04 10088 | 2003-10-01 16:00:00-04 (13 rows) Ted __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings |
#3
| |||
| |||
|
|
On Wed, Oct 01, 2003 at 10:26:57 -0700, Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> wrote: I am not sure but i thought I read something of this problem and maybe its not a problem but my understanding. There are only 30 days in september however I can not seem to make a query that asks for october 1. You shouldn't be refering to September 31 as that isn't a valid date. From your output it looks like it may have been treated as the same as October 1, but I wouldn't count on that working in the future. proofduedate is time stamp with zone maybe this is the problem but I am a little lost. SELECT jobnumseq, proofduedate FROM jobs WHERE proofduedate BETWEEN to_timestamp('29 September 2003', 'DD Month YYYY') AND to_timestamp('31 September 2003 23:59', 'DD Month YYYY HH24:MI'); jobnumseq | proofduedate -----------+------------------------ 10080 | 2003-09-30 17:00:00-04 10081 | 2003-09-30 22:00:00-04 10082 | 2003-10-01 16:00:00-04 10074 | 2003-09-29 16:00:00-04 10077 | 2003-09-29 16:00:00-04 10078 | 2003-09-29 18:00:00-04 10079 | 2003-09-30 15:00:00-04 10083 | 2003-10-01 13:00:00-04 10084 | 2003-10-01 13:00:00-04 10085 | 2003-10-01 13:00:00-04 10086 | 2003-10-01 16:00:00-04 10087 | 2003-10-01 16:00:00-04 10088 | 2003-10-01 16:00:00-04 (13 rows) Ted __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org |
#4
| |||
| |||
|
|
I am sorry, I wasn't clear... when i refered to 01 October 2003 I got zero results. I only got results for the October 1 date when i refered to it as september 31.... |
#5
| |||
| |||
|
|
Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> writes: I am sorry, I wasn't clear... when i refered to 01 October 2003 I got zero results. I only got results for the October 1 date when i refered to it as september 31.... That's a bit hard to believe. Could you show us the results of the individual to_timestamp operations ("select to_timestamp(...)")? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html |
#6
| |||
| |||
|
|
Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> writes: I am sorry, I wasn't clear... when i refered to 01 October 2003 I got zero results. I only got results for the October 1 date when i refered to it as september 31.... That's a bit hard to believe. Could you show us the results of the individual to_timestamp operations ("select to_timestamp(...)")? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html |
#7
| |||
| |||
|
|
Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> writes: I am sorry, I wasn't clear... when i refered to 01 October 2003 I got zero results. I only got results for the October 1 date when i refered to it as september 31.... That's a bit hard to believe. Could you show us the results of the individual to_timestamp operations ("select to_timestamp(...)")? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html |
#8
| |||
| |||
|
|
I should have sent this... it is very interesting.. agencysacks=# select to_timestamp('01 October 2003 00:01', 'DD Month YYYY HH24:MI'); to_timestamp --------------------- 0003-10-01 00:01:00 (1 row) |
#9
| |||
| |||
|
|
Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> writes: I should have sent this... it is very interesting.. agencysacks=# select to_timestamp('01 October 2003 00:01', 'DD Month YYYY HH24:MI'); to_timestamp --------------------- 0003-10-01 00:01:00 (1 row) Oh ... duh ... you should have said regression=# select to_timestamp('01 October 2003 00:01', 'DD FMMonth YYYY HH24:MI'); to_timestamp ------------------------ 2003-10-01 00:01:00-04 (1 row) There's been repeated discussion about whether our to_timestamp code should be more forgiving of input that does not match the given format, but right at the moment it's pretty unforgiving. BTW, have you considered the likelihood that you shouldn't be using to_timestamp at all? The timestamp datatype input converter gets this right: regression=# select '01 October 2003 00:01'::timestamp; timestamp --------------------- 2003-10-01 00:01:00 (1 row) ISTM that to_timestamp is intended for cases where you want to be rigid about the data format. If you think that the input data is self-explanatory then try just casting it to timestamp. |
#10
| |||
| |||
|
|
Theodore Petrosky <tedpet5 (AT) yahoo (DOT) com> writes: I should have sent this... it is very interesting.. agencysacks=# select to_timestamp('01 October 2003 00:01', 'DD Month YYYY HH24:MI'); to_timestamp --------------------- 0003-10-01 00:01:00 (1 row) Oh ... duh ... you should have said regression=# select to_timestamp('01 October 2003 00:01', 'DD FMMonth YYYY HH24:MI'); to_timestamp ------------------------ 2003-10-01 00:01:00-04 (1 row) There's been repeated discussion about whether our to_timestamp code should be more forgiving of input that does not match the given format, but right at the moment it's pretty unforgiving. BTW, have you considered the likelihood that you shouldn't be using to_timestamp at all? The timestamp datatype input converter gets this right: regression=# select '01 October 2003 00:01'::timestamp; timestamp --------------------- 2003-10-01 00:01:00 (1 row) ISTM that to_timestamp is intended for cases where you want to be rigid about the data format. If you think that the input data is self-explanatory then try just casting it to timestamp. regards, tom lane |
![]() |
| Thread Tools | |
| Display Modes | |
| |