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

Re: date formatting question

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: PostgreSQL List - Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: date formatting question
Date: 2008-07-03 10:27:52
Message-ID: 486CA9A8.5080502@sympatico.ca (view raw or flat)
Thread:
Lists: pgsql-novice
richard terry wrote:
> I'm using gambas to save some data to the database, and use the date from a 
> textbox to write to the database in format 'dd/mm/yyyy', however when I look 
> at the database using pgadmin3 , the date is stored as eg 2008/10/02 
> yyyy/dd/mm.
> 
> If I re-display it with  a formatting option like:  
> Format(referral.date, "dd/mm/yyyy")    then it looks ok in my program
> 
> does it matter that is 'round the wrong way' in the database, or is there some 
> way to tell the database to do it the other way around.


Actually; that is NOT how a date is stored in the database; what you see 
is the default format being applied:

http://www.postgresql.org/docs/8.3/interactive/runtime-config-client.html#GUC-DATESTYLE

You can (perhaps you'll need more than one):
1) change the default datestyle in postgressql.conf
2) change datestyle with every connection "set datestyle ..."
3) change default datestyle in pgadmin3 (maybe; I don't use this).

Frank

In response to

pgsql-novice by date

Next:From: MiernikDate: 2008-07-04 07:17:11
Subject: how to create a function in plpgsql which picks the name of a variable which is NULL out of a list of variables?
Previous:From: NetzachDate: 2008-07-03 09:29:56
Subject: Re: Calculating repeating events - functionality lost with the demise of tinterval ?

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