Re: [GENERAL] datetime problems - Mailing list pgsql-general

From Memphisto
Subject Re: [GENERAL] datetime problems
Date
Msg-id Pine.GSO.3.96.981021173942.29288D-100000@valerie.inf.elte.hu
Whole thread Raw
In response to Re: [GENERAL] datetime problems  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Responses Re: [GENERAL] datetime problems
List pgsql-general
> Probably because the parentheses are not balanced in the first query. But
> why the subqueries, anyway? Why not simply:
>
> SELECT * FROM annex_log
> WHERE login_start
>     BETWEEN date_trunc('month','now'::datetime)
>         AND ( date_trunc('month','now'::datetime) + '1 month'::timespan);
>
> (Note that I also removed the redundant type conversion you did on '1 month').
Noted, thanks. I'm a newbie in postgreSQL and happy that these types and
functions exist, but I think the documentation is a bit spartan(lacks a
lot of pieces of information) and depend on those bits that are there in
the documentation.

>
> Again, I recommend doing the >=, < thing rather than 'between', because
> 'between' will also allow the actual value of 1998-09-01 (for example) to
> be included. It's a close interval, rather than a half-open one.
That's right, I didn't know about the behaviour of 'between'. I'm going
to use '>=' and '<'.

Another question. Is there way to these truncation to weeks instead of
months. As far as I know, postgreSQL does not support it.

--------------------------------------------------------------------------------
Sebestyén Zoltán AKA Memphisto        It all seems so stupid,
                    it makes me want to give up.
szoli@neumann.cs.elte.hu        But why should I give up,
                                        when it all seems so stupid?

MAKE INSTALL NOT WAR            And please avoid Necrosoft Widows



pgsql-general by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] datetime problems
Next
From: "Jackson, DeJuan"
Date:
Subject: RE: [GENERAL] questions