You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Martin I. Levi" <ml...@labtie.mmt.upc.es> on 2004/07/01 13:49:12 UTC

Date formatting in OJB?

Hi!

When I obtain a date throw OJB its format changes from the original
configured in the DB. I mean my postgres DB is set to show dates
in a "dd/mm/yyyy" format an OJB shows a "yyyy-mm-dd" format.
Is there anyway to configure OJB to work with a particular date format
or do I have to do this through Java "manually" ?

Thanks in advance!

-- 
Saludos,

Martin I. Levi

Centre Tecnològic de Transferenciència de Calor
Universitat Politècnica de Catalunya
www.cttc.upc.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Date formatting in OJB?

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi martin,

ojb does not use the dateformat defined in the database.

jakob

Martin I. Levi wrote:

> Hi!
> 
> When I obtain a date throw OJB its format changes from the original
> configured in the DB. I mean my postgres DB is set to show dates
> in a "dd/mm/yyyy" format an OJB shows a "yyyy-mm-dd" format.
> Is there anyway to configure OJB to work with a particular date format
> or do I have to do this through Java "manually" ?
> 
> Thanks in advance!
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: Date formatting in OJB?

Posted by "Martin I. Levi" <ml...@labtie.mmt.upc.es>.
Yep, I figured out this later... the solution I found is to create a
subclass from Date, override the toString() method and create a custom
convertion between the SQL DATE type and my CustomDate java class.
I mean I had no interest on manipulating the date, i just wanted to have
it in a String in order to store it in a presentation bean and show it
in the "latin" way. This is the simplest reformatting I could think
about. :)


On Thu, 2004-07-01 at 20:37, Guillaume Nodet wrote:
> > 
> > When I obtain a date throw OJB its format changes from the original
> > configured in the DB. I mean my postgres DB is set to show dates
> > in a "dd/mm/yyyy" format an OJB shows a "yyyy-mm-dd" format.
> > Is there anyway to configure OJB to work with a particular date format
> > or do I have to do this through Java "manually" ?
> > 
> > Thanks in advance!
> > 
> 
> OJB does not format date by itself if you use columns of type date
> in your database. It will only work with the "real" date, not the
> display string for this date. So when you retrieve the date and want
> to display it, it is up to you to use the format you want.
> 
> Guillaume Nodet
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
-- 
Saludos,

Martin I. Levi

Centre Tecnològic de Transferenciència de Calor
Universitat Politècnica de Catalunya
www.cttc.upc.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


RE: Date formatting in OJB?

Posted by Guillaume Nodet <gu...@deliasystems.com>.
> 
> When I obtain a date throw OJB its format changes from the original
> configured in the DB. I mean my postgres DB is set to show dates
> in a "dd/mm/yyyy" format an OJB shows a "yyyy-mm-dd" format.
> Is there anyway to configure OJB to work with a particular date format
> or do I have to do this through Java "manually" ?
> 
> Thanks in advance!
> 

OJB does not format date by itself if you use columns of type date
in your database. It will only work with the "real" date, not the
display string for this date. So when you retrieve the date and want
to display it, it is up to you to use the format you want.

Guillaume Nodet

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org