Обсуждение: date formatting question

Поиск
Список
Период
Сортировка

date formatting question

От
richard terry
Дата:
Hi,

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.

Thanks in anticipation.

richard



Re: date formatting question

От
Frank Bax
Дата:
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