Skip site navigation (1) Skip section navigation (2)

problem with date

From: David Sauer <davids(at)penguin(dot)cz>
To: pgsql-general(at)postgreSQL(dot)org, pgsql-bugs(at)postgreSQL(dot)org
Subject: problem with date
Date: 1999-10-27 19:17:27
Message-ID: m2wvs8mx4o.fsf@chameleon.localdomain (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-general
Hello,

 I have problem with date:

# current date from OS prompt ...
% LC_ALL=C date
Wed Oct 27 21:08:56 CEST 1999

david=> select date('now');
      date
----------
01-01-2000
(1 row)

I expect current date, not 1.1.2000 ... interesting solution of Y2K problem, 
but unusable ...

david=> select date('now'::date);
      date
----------
10-27-1999
(1 row)

This works, but why I need cast ?

david=> select date('hhhh');
date         
-------------
11--2-4714 BC

I expect something like 'Bad external representation ....'

And finally, I have question: is there difference between 
"date('now')" and "date(now())" ?


My pgsql version:

david=> select version();
version                                                      
-------------------------------------------------------------
PostgreSQL 6.5.2 on i586-pc-linux-gnu, compiled by gcc 2.95.1
(1 row)

I have glibc from RH 6.1.


                                                Thanks,

-- 
* David Sauer, student of Czech Technical University
* electronic mail: davids(at)penguin(dot)cz (mime compatible)

pgsql-bugs by date

Next:From: ednutDate: 1999-10-28 09:20:42
Subject: Re: Linux/Postgres 6.5 problems using jdbc w/jdk1.2
Previous:From: Tom LaneDate: 1999-10-27 14:28:11
Subject: Re: [SQL] Date comparisons

pgsql-general by date

Next:From: Brett W. McCoyDate: 1999-10-27 20:21:24
Subject: Re: [GENERAL] foreign key
Previous:From: FontDate: 1999-10-27 19:16:27
Subject: Generic ODBC and column alias questions (fwd)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group