I think I have the solution.

When I ask the user for the timezone, I store it as an offset in minutes
from GMT.  The problem occurs if the user reconnects after the timezone has
changed to/from daylight savings time relative to the date when he or she
originally chose the timezone.  For example, if someone in continental
europe specifies their timezone in winter, it's GMT/UTC +60.  In summer,
it's UTC+120... However, as I didn't know if they chose during or
before/after daylight savings changes, I would not be able to calculate
time-critical events correctly relative to the timezones of other users....

What I will do therefore is to store every timezone offset relative to
GMT/UTC.  In order to do this, I'll use a reference timezone.  For example,
I know that in winter, in the UK locale, GMT offset is 0, but during summer,
the offset is  +60.  I know therefore whether or not to apply changes.
Doesn't provide the perfect solution as I don't know which countries do or
do not apply such changes, but for the moment, given the countries I use, I
can get away with this (and a checkbox to say "do not apply daylight savings
changes").

-Chris

----- Original Message -----
From: "sandarbh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 20, 2001 5:45 PM
Subject: Re: date problems


> Hi Chris ,
>
> please see following line of code
> *****************************************
> Calendar df_curr = Calendar.getInstance();
> Calendar df = Calendar.getInstance();
> ----------
> ---------
> Date dcurr =new Date(CurRec);
>
> df_curr.setTime(dcurr);
>
> ***********************
> so now i have two instances df and df_curr
>
> one set to systime and next to some other time.
> now i am extracting various values as
> int month_curr = df_curr.get(Calendar.MONTH);
>
> but i need to know exact difference irrespective of year between two dates
> in days..
>
> Can you please explain further..
>
> sandarbh
>
>
> ----- Original Message -----
> From: "chris brown" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 20, 2001 3:45 PM
> Subject: Re: date problems
>
>
> > You should be able to extract a Date object (using Calendar.getTime()) ,
> > then from this Date, call getTime() to get a long (in milliseconds).  Do
> the
> > same for your other date, then compare the two long values.
> >
> > A day can generally be assumed to be equal to :
> > 1000ms * 60s * 60m * 24h
> >
> > You may wish to set your two Calendar objects to 00:00:00.000
> (hh:mm:ss.ms)
> > before extracting the time to eliminate perhaps redundant information,
or
> > you could use modulus or or division operators (% or /) on the resulting
> > long values for the same thing.  Depends upon what you need to do...
> >
> > In any case, this should work around any month or year boundary
problems.
> >
> > -Chris
> >
> > ----- Original Message -----
> > From: "sandarbh" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, April 20, 2001 1:37 PM
> > Subject: date problems
> >
> >
> > > Hi all,
> > > I want to have exact difference in days for two days in Java. If for
the
> > > current year , then I am able to extract exact info using calender
> class,
> > > but across the years its not possible?? can any one suggest a better
way
> > > please??
> > >
> > > Thanks in anticipation.
> > >
> > > sandarbh
> > >
> > >
> >
>
===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to