Re: [GENERAL] datetime problems

From: Memphisto <szoli(at)valerie(dot)inf(dot)elte(dot)hu>
To: Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] datetime problems
Date: 1998-10-21 15:48:01
Message-ID: Pine.GSO.3.96.981021173942.29288D-100000@valerie.inf.elte.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)neumann(dot)cs(dot)elte(dot)hu But why should I give up,
when it all seems so stupid?

MAKE INSTALL NOT WAR And please avoid Necrosoft Widows

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jackson, DeJuan 1998-10-21 16:56:00 RE: [GENERAL] questions
Previous Message Herouth Maoz 1998-10-21 15:33:55 Re: [GENERAL] datetime problems