get time from devices local time using offset variable

239 Views Asked by At

Hello I am using the threeten library that provides me with the object org.threeten.bp.OffsetDateTime. The application works great when I am on EST time, but when I manually change my device to Pacific time to make sure the times are being displayed correctly, I am still getting EST time. I thought when using this object, the object obtains the current time and time zone from the device. I have tried the following and obtain the date string in EST. Any thoughts? Thank you for your help

Code:

OffsetDateTime time = OffsetDateTime.now();
Log.i(TAG, time.tostring());

output: 2017-07-31T19:49:11.828-04:00

0

There are 0 best solutions below