problems with datestyle
problems with datestyle
От:
João Paulo F. Diniz <jpaulo@dcc.ufmg.br>
Дата:
Hi, I'm using a java program to connect to a postgresql database (I'm using postgresql version 7.2.1). I'd like to retrieve a value of type DATE with ResultSet.getString() method in the format dd/mm/yyyy without make any more changes in the program. I've already tried to Change PGDATESTYLE to "sql, european". When I access database on the console whith postgres user all dates are showed in format dd/mm/yyyy, but it doesn't with a java program. How can I use postmaster whith options -o -e? OR How can I change datastyle in postgresql.conf? Thanks in advance!
Re: problems with datestyle
От:
Kris Jurka <books@ejurka.com>
Дата:
On Thu, 1 Apr 2004, [ISO-8859-1] Jo�o Paulo F. Diniz wrote: > Hi, > > I'm using a java program to connect to a postgresql database (I'm using > postgresql version 7.2.1). > I'd like to retrieve a value of type DATE with ResultSet.getString() > method > in the format dd/mm/yyyy without make any more changes in the program. > > I've already tried to Change PGDATESTYLE to "sql, european". You cannot change the datestyle as the JDBC driver resets it to iso format on connection start. This simplifies the driver's life as it only needs to know how to parse one date format. If you want to format a date you should be looking at getDate() and using java.text.DateFormat to make it come out as you want instead of getString(). Kris Jurka