-->
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.  [ 4 posts ] 
Author Message
 Post subject: lucene.document.DateTools
PostPosted: Mon Sep 27, 2010 4:55 pm 
Newbie

Joined: Fri Jul 09, 2010 7:52 pm
Posts: 4
When I use round or dateToString Function on DateTools class it is giving me wierd dates. If my date is for example 2008-15-10 11:22 and I try to round it to the DAY it is returning 20081510 but if only the hour is past 20:00 it increments the day for some reason. IE: 2008-15-10 21:22 would give me 20081511. Is this a bug or I am doing sthing wrong?


Top
 Profile  
 
 Post subject: Re: lucene.document.DateTools
PostPosted: Mon Sep 27, 2010 6:17 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
did you check the timezone being used by the server where this is run?
The "2008-15-10 11:22" is not the internal representation but some form of visualization relative to the locale where the conversion is run (maybe your client? or a clever webapp localizing the time for you?), so it's possible that for the server an hour representing something >20h is really "tomorrow" from his point of view.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: lucene.document.DateTools
PostPosted: Sun Oct 10, 2010 6:44 pm 
Newbie

Joined: Fri Jul 09, 2010 7:52 pm
Posts: 4
I run it on JBoss and user.timezone = America/New_York so it is correct, the date is timestamp from mysql which I think uses my system timezone: GMT-5 eastern time. I still don't know where that time shift could happen?


Top
 Profile  
 
 Post subject: Re: lucene.document.DateTools
PostPosted: Mon Oct 11, 2010 6:07 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
as stated on the reference documentation in paragraph 4.2.1. Built-in bridges, all Dates are converted and indexed using GMT timezone.
This is strongly recommended for all servers, it really simplifies a lot of Date-math operations; you should covert to a different timezone on the presentation layer only.

BTW I might be wrong, but I think that GMT-5 is not the same as America/New_York, at least not at all moments of the year, as each state applies daylight shifts/legal hours at dates they decide themselves; another good reason to avoid using localized times on the server side.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.