Re: [GENERAL] troubles with datestyle

From: Bob Kline <bkline(at)rksystems(dot)com>
To: Herbert Liechti <Herbert(dot)Liechti(at)thinx(dot)ch>
Cc: postgres <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] troubles with datestyle
Date: 1999-11-12 14:58:01
Message-ID: Pine.LNX.4.10.9911120952270.21878-100000@rksystems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 12 Nov 1999, Herbert Liechti wrote:

> Hi
>
> Is there a way to select by date in format which is language independent.
>
> select name, ....., date from table
> where date >= '1-1-1999' and date <= '11-1-1999';
>
> I use the Perl DBI und Postgres DBD driver. In the begin of the session
> I set the datestyle variable to the current user language (german or us).
> I loose this setting when I set the datestyle to 'german'. When I
> do a
>
> select name, ....., date from table
> where date >= '1.1.1999' and date <= '1.11.1999';
>
> the resultset is from january first to january 11 instead to the first of
> november.
>
> Any hints?
> Herbie

Use the ISO standard syntax for specifying dates in SQL:

SELECT name,
....,
date
FROM table
WHERE date >= '1999-01-01'
AND date <= '1999-11-01';

I hope you're using column names which don't conflict with reserved
words (like date).

--
Bob Kline
mailto:bkline(at)rksystems(dot)com
http://www.rksystems.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Herbert Liechti 1999-11-12 15:01:31 troubles with datestyle
Previous Message V Krishnaraj 1999-11-12 14:42:10 Re: Postgres concurrency : urgent