I have a LocalTime variable and a separate DateTimeZone variable and want to 
know what the corresponding local time will be in a different timezone. I read 
the user guide for how to do this for a DateTime class (an instant), but it 
seems like it should be a valid operation on a partial as well as long as the 
old and new time zones are specified.

I guess one option is to convert my LocalTime to a DateTime using LocalTime's 
toDateTimeToday() method: 
http://joda-time.sourceforge.net/api-release/org/joda/time/LocalTime.html#toDateTimeToday(org.joda.time.DateTimeZone)

then performing the conversion as specified in the user guide:

// translate to London local time
    DateTime dtLondon = dt.withZone(DateTimeZone.forID("Europe/London"));
And then converting back to a LocalTime using DateTime's toLocalTime() method: 
http://joda-time.sourceforge.net/api-release/org/joda/time/DateTime.html#toLocalTime()

But this all seems convoluted. Doesn't seem like I should have to specify 
arbitrary date fields just to get the time in a different timezone. Are there 
any other ways to do this?

Thanks,
Ken





------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to