[Opensource] Expresso - how to change the date format
question
Michael Rimov
rimovm at centercomp.com
Mon Sep 9 15:41:25 PDT 2002
At 01:05 PM 9/9/2002 -0400, you wrote:
>Hi,
>
>I'm trying to change the date format used in Expresso from "yyyy-mm-dd" to
>"dd/mm/yy".
>I already have in my expresso-config.xml,jdbc section
>the next 4 parameters:
>
>dateSelectFormat="dd/MM/yy"
>dateUpdateFormat="dd/MM/yy"
>dateTimeSelectFormat="dd/MM/yy"
>dateTimeUpdateFormat="dd/MM/yy"
Hi Milen!
What you're running up against is "by design"... getField() will ALWAYS
return 'yyyy-mm-dd', and the above methods are used for telling Expresso
how to convert the standard JDBC date format into something your database
will understand.
So what to do? I suggest you use getFieldDate() to return a java.util.Date
object and then run that through a java.text.DateFormat to get it set
properly for your program. There's an example of this usage in:
com.jcorporate.expressso.services.controller.ui.DefaultAutoElement
HTH!
-Mike
>Are there any other settings I nedd to change ?
>
>I have no problems to add/update a record using DBMaint for example.
>But I get errors when I'm using DBMaint to list records:
> "Nested exception message:(com.ansco.accounting.gl.dbobj.MyDBObject)
>Unable to parse a date value from field 'date' which contained
>'2002-01-01' using pattern 'dd/MM/yy'"
>
>The problem is that date values in my myDBObject are in format "yyyy-mm-dd"
>and cannot be parsed using the new format "dd/mm/yy".
>And I can figure out why DBConection.getString(i) method still returns
>date field values in format "yyyy-mm-dd". (I expect them in the new format
>"dd/mm/yy")
>
>Any help will be greatly appresiated!
>Than you in advance!
>
>I'm using Expresso 4.1 ea2
>
>Milen
>
>------------------------------------
>here is a part of my expresso-config.xml
> <context name="DB start">
> <description>DB start </description>
> <jdbc
> driver="org.postgresql.Driver"
> url="jdbc:postgresql://192.168.5.100:5432/dbstart"
> connectFormat="3"
> login="postgres"
> password="postgres"
> cache="y"
>
> dateSelectFormat="dd/MM/yy"
> dateUpdateFormat="dd/MM/yy"
> dateTimeSelectFormat="dd/MM/yy"
> dateTimeUpdateFormat="dd/MM/yy"
>
> />
> <type-mapping>
> <java-type>INTEGER</java-type>
> <db-type>INTEGER</db-type>
> </type-mapping>
> <type-mapping>
> <java-type>FLOAT</java-type>
> <db-type>FLOAT8</db-type>
> </type-mapping>
>
More information about the Opensource
mailing list