Struggling with how to compare hours with different time zones in Java?
Posted
by Riki
on Stack Overflow
See other posts from Stack Overflow
or by Riki
Published on 2010-05-26T10:08:37Z
Indexed on
2010/05/26
10:11 UTC
Read the original article
Hit count: 168
Hi!
I have 2 date object in the database that represent the company's working hours.
I only need the hours but since I have to save date. it appears like this:
Date companyWorkStartHour;
Date companyWorkEndHour;
start hours: 12-12-2001-13:00:00 finish hours: 12-12-2001-18:00:00
I have the timezone of the company and of the user. (my server may be in another timezone).
TimeZone userTimeZone;
TimeZone companyTimeZone;
I need to check if the user's current time (considering his timezone) is within the company working hours (considering the company's time zone).
How can I do it? I am struggling for over a week with Java calendar and with no success!
© Stack Overflow or respective owner