Thanks Barend.

How the same can be acheived using DateTime? 
I did following operations client side with timezone IST.

>From client side I used withZone, passed server timezone id, to convert 
>Datetime object of client timezone(IST) to DateTimeobject of server 
>timezone(PST/PDT). I tried printing DateTime and it gave me correct server 
>timezone.

But my ultimate aim is to fetch the date object . So I used DateTime.toDate(). 
The resultant gave me client time. Can you please help in this regard?

Thanks again.
Suganthi.


--- On Thu, 4/23/09, W.B. Garvelink <barend.garvel...@gmail.com> wrote:

> From: W.B. Garvelink <barend.garvel...@gmail.com>
> Subject: Re: [Joda-interest] Converting Date from one timezone to another
> To: "Discussion of the Joda project" <joda-interest@lists.sourceforge.net>
> Date: Thursday, April 23, 2009, 2:53 AM
> Hi Suganthi,
> 
> The java.util.Date object has no timezone information, so
> there is no
> such conversion possible.
> 
> Since you're already posting on the Joda-Time mailing
> list, the
> easiest fix is to stop using java.util.Date altogether and
> switch to
> using Joda's DateTime class.
> 
> If you're forced to use util.Date (I think there is a
> UN resolution
> against that... there should be), you'll have to carry
> around the time
> zone information in a separate variable and pass it into
> the
> DateFormat before you parse or print a util.Date as String.
> You can
> also use util.Calendar instead of util.Date. The Calendar
> object
> carries a time zone with it, but keep in mind that if you
> use it and
> DateFormat together, you still have to set the time zone on
> the
> DateFormat by hand. It's an error-prone mess, avoid if
> you can.
> 
> 
> Hope this helps,
> 
> Barend
> 
> 
> 
> On Wed, Apr 22, 2009 at 7:54 PM, suganthi kaliamoorthy
> <suganth...@yahoo.com> wrote:
> >
> > Hi,
> >
> > Can someone please help how to convert Date object
> from one timezone to another?
> >
> > I have java.util.Date object with currentTime in one
> zone. Have to convert this to date of different timezone.
> >
> > Thanks,
> > Suganthi.
> >
> 
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside
> and 
> around Java (TM) technology - register by April 22, and
> save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San
> Francisco.
> 300 plus technical and hands-on sessions. Register today. 
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest



      

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to