using android and joda time lib - the I am trying to convert the user's timezone in order to format it later to : 2012-11-12T21:45:00+02:00 for example.
DateTimeZone zone = DateTimeZone.forID( TimeZone.getDefault().getID());
the above code fails - anyone know how can I take "Europe/London" (Timezone.getID) and convert it to an offset so I can put it in ISO 8601 format?
If I correctly understood your objective you can use directly the
SimpleDateFormat
class.Example code:
You can see docmentation in SimpleDateFormat
Regards.
API level 26 added support for many time and date classes from Java. So this solution can now also be applied: https://stackoverflow.com/a/25618897/3316651
Credits to JodaStephen.
Android doc: https://developer.android.com/reference/java/time/format/DateTimeFormatter.html#ISO_INSTANT