-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: I18N and Dates
PostPosted: Mon Dec 20, 2004 3:31 am 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
My case is pretty basic but I'd like to know what you think about it.
I developed an application for french people and the application is hosted in Canada.
I'd like to be sure that dates are stored in the french timezone. At which level I should change the code ?

MyClass {
java.util.Date created;

public MyClass {
this.created = new Date(); // Something wrong here ?
}
}


should I do the conversion in the Hibernate Date type with a UserType
or when I create the Date ? maybe with something like :

TimeZone.setDefault(TimeZone.getTimeZone(...FRANCE...))
Calendar calendar = Calendar.getInstance(Locale.fr_FR);
created = new java.sql.Date(calendar.getTime().getTime());

or

TimeZone.setDefault(TimeZone.getTimeZone(...FRANCE...))
Calendar calendar = Calendar.getInstance(Locale.fr_FR);
created = calendar.getTime();

Thank you for your help.
R.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 20, 2004 6:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
*Never* store dates with timezone information!

Always store them as UTC times, then you won't have any issues as it will then be up to the app to display it in the proper timezone!

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.