Обсуждение: Date Formatting for dd/mm/yyyy

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

Date Formatting for dd/mm/yyyy

От
J Ottery
Дата:
Hi all.
I am using Postgres 8.3 with Windows XP Pro.
System date format is dd/MM/yyyy

Having problems when I writing records to a database with a single
'date' type field.

e.g.  FieldByName('Date').ASString:='2/2/2003'

When the row is viewed in pgAdmin it is always 1899-12-30

I have tried changing the datestyle in postgresql.conf thus:

datestyle='iso,dmy'
datestyle='dmy'
datestyle='ymd'
datestyle='European'

also

lc_time= 'English_Australia.1252'

(obviously stopping and starting Server)


Nothing seems to make any difference.
Who has got an answer to this.

Also thanks to Craig Ringer and others for answering my earlier
questions, it greatly helped me get up and running with postgres.





Re: Date Formatting for dd/mm/yyyy

От
Klint Gore
Дата:
J Ottery wrote:
> Hi all.
> I am using Postgres 8.3 with Windows XP Pro.
> System date format is dd/MM/yyyy
>
> Having problems when I writing records to a database with a single
> 'date' type field.
>
> e.g.  FieldByName('Date').ASString:='2/2/2003'
>
What is delphi's ShortDateFormat set to?

Does fieldbyname('Date').asdatetime := strtodate('2/2/2003') make any
difference?

klint.

--
Klint Gore
Database Manager
Sheep CRC
A.G.B.U.
University of New England
Armidale NSW 2350

Ph: 02 6773 3789
Fax: 02 6773 3266
EMail: kgore4@une.edu.au


Re: Date Formatting for dd/mm/yyyy

От
Artacus
Дата:
J Ottery wrote:
> Hi all.
> I am using Postgres 8.3 with Windows XP Pro.
> System date format is dd/MM/yyyy
>
> Having problems when I writing records to a database with a single
> 'date' type field.

I may be confused here. You say writing was your problem but it sounds
like the problem is when you read the records out.

The way dates are displayed is dependent on (and configured in) the
client not on the server. So if you have a specific format you want your
  dates displayed then you need to convert them to a string in your query.

Artacus