mercredi 11 mars 2015

How to create TimeZone relative to something else than UTC/GMT in java



I need to create a timeZone which is a fix offset to America/New_York


I would like to do something like that (DateTime lib): DateTimeZone MyTimeZone = DateTimeZone.forID("America/New_York+17");


But it is not possible.


The only thing i can do - is to get current offset to UTC/GMT and shift it by my additional offset.


DateTimeZone.forOffsetMillis(NYTimeZone.getOffset(time)+dt)


But this is not efficient - because i need to know the current time to know the current offset.


Thanks




Aucun commentaire:

Enregistrer un commentaire