Re: date format and postgreSQL...

From: Date: Thu, 09 Nov 2000 21:08:16 +0000
Subject: Re: date format and postgreSQL...
References: 1 2  Groups: php.db php.general 
Request: Send a blank email to php-db+get-4346@lists.php.net to get a copy of this message
Javier, === Javier Morquecho Morquecho escribia (Thu, Nov 09, 2000 at 02:57:05PM -0600): > Hi... > > I guess this is a very simple question, but it is drive me creazy (may be I > need vacations)... > > I'm using PostgreSQL, and I have problems to understend date management... > > I execute the next insert commands... > insert into test values ('any1', '2/11/2000') > insert into test values ('any1', '2/10/2000') > insert into test values ('any1', '20/10/2000') > > But when I do a select * from test: > any|02-11-2000 > any|02-10-2000 > any|10-20-2000 > > And, When I'm reading my recorset I have a date with "dd-mm-yyyy" and > another date with "mm-dd-yyyy"... > > What's going on?... > > Thanks in advance... I think PostgreSQL is trying to be "too" smart, it accepts your dates and takes them as 'mm/dd/yyyy', but when it sees in mm something that cannot be a month (20 in your case ) it plays tricks to see if the date string can be parsed as 'dd/mm/yyyy'. Now 20 makes sense as a day number. Then it just spits the dates in the default format 'mm-dd-yyyy'. You might try feeding it date strings formatted as 'yyyy/mm/dd', it won't change a thing but it might be less confusing. HTH Manuel Garcia

« previous php.db (#4346) next »