pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Date formats in 7.0b2
2+ messages / 2 participants
[nested] [flat]

* Date formats in 7.0b2
@ 2000-04-05 17:07  Hernan J. Gonzalez <leonbloy@yahoo.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Hernan J. Gonzalez @ 2000-04-05 17:07 UTC (permalink / raw)
  To: pgsql-admin

I'm puzzled with the date formats in
the 7.0b2 version. Perhaps I'm missing something
trivial, (SQL standards?) but I have been using postgres
from years, and never had this kind of problem.

I use the -e switch, so that
> dates passed to and from the
> frontend processes will be
> assumed to be in "European" format (DD-MM-YYYY)
(from the postgres man page)

Now, it seems that 7.0b2  accepts dates in this
format  AS INPUT but the dates  in the OUTPUT
are always in the YYYY-MM-DD  format ...

Needless to say, this has devasting effects on
my scripts!

Further, postgres seems to accept BOTH
formats as input, and even with 2 digits
in the year... and with some strange results.
I attach some queries below.

Regards

Hernan Gonzalez
Buenos Aires, Argentina
hgonzal@sinectis.com.ar

#######################################################################

 testdb=# select fecha from eventos where fecha >= '31-01-2001';
    fecha
 ------------
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (4 rows)

It accepts european DD-MM-YYYY date (ok) but outputs YYYY-MM-DD  (?)
(Doesn't seem to be a psql issue)


 testdb=# select fecha from eventos where fecha >= '01-31-2001';
 ERROR:  Bad date external representation '01-31-2001'

Refuses MM-DD-YYYY date (ok, I'm usign the -e switch ) ]


 testdb=# select fecha from eventos where fecha >= '2001-01-31';
    fecha
 ------------
  2001-02-01                                                                   

  2001-03-01
  2002-01-01
  2002-02-01
 (4 rows)

Accepts YYYY-MM-DD also ...


 testdb=# select fecha from eventos where fecha >= '01-01-01';
    fecha
 ------------
  2001-01-01
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (5 rows)

Accepts DD-MM-YY  also  ....


 testdb=# select fecha from eventos where fecha >= '1-1-1';
    fecha
 ------------
  2000-02-01
  2000-04-01
  2000-05-01
  2000-06-01
  2000-07-01
  2000-08-01
  2000-09-01
  2000-10-01
  2000-11-01
  2000-11-17       
  2000-12-20
  2001-01-01
  2001-02-01
  2001-03-01
  2002-01-01
  2002-02-01
 (17 rows)

?? What does this mean ????


Now, let's see what if XX-XX-XX is understood as DD-MM-YY or YY-MM-DD ...

 testdb=# select fecha from eventos where fecha >= '03-02-01';
    fecha
 ------------
  2001-03-01
  2002-01-01
  2002-02-01
 (3 rows)


testdb=# select fecha from eventos where fecha >= '01-02-03';
 fecha
-------
(0 rows)

.... so, XX-XX-XX is understood as DD-MM-YY
                                                                             



__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Date formats in 7.0b2
@ 2000-04-06 10:27  Karel Zak <zakkr@zf.jcu.cz>
  parent: Hernan J. Gonzalez <leonbloy@yahoo.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Karel Zak @ 2000-04-06 10:27 UTC (permalink / raw)
  To: Hernan J. Gonzalez <leonbloy@yahoo.com>; +Cc: pgsql-admin


On Wed, 5 Apr 2000, Hernan J. Gonzalez wrote:

> I'm puzzled with the date formats in
> the 7.0b2 version. Perhaps I'm missing something
> trivial, (SQL standards?) but I have been using postgres
> from years, and never had this kind of problem.
> 
> I use the -e switch, so that
> > dates passed to and from the
> > frontend processes will be
> > assumed to be in "European" format (DD-MM-YYYY)
> (from the postgres man page)
> 
> Now, it seems that 7.0b2  accepts dates in this
> format  AS INPUT but the dates  in the OUTPUT
> are always in the YYYY-MM-DD  format ...
> 


 You can use in 7.0 to_char() to_date() to_timestamp() functions for full 
date-time format controlling or conversion. 

						Karel




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-04-06 10:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-04-05 17:07 Date formats in 7.0b2 Hernan J. Gonzalez <leonbloy@yahoo.com>
2000-04-06 10:27 ` Karel Zak <zakkr@zf.jcu.cz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox