How to get UTC offset in seconds in android

后端 未结 2 1489
南笙
南笙 2021-02-07 02:23

I\'m trying to get the UTC offset in seconds in android. Since the emulator keeps returning 0, I can\'t tell if I\'m doing this correctly or not.

    Calendar c=         


        
2条回答
  •  盖世英雄少女心
    2021-02-07 02:30

    The default timezone of the emulator is GMT, meaning you will always get an offset of 0. Your code looks fine (I didn't try it). Try changing the timezone of your emulator to something else and check your code. Take a look in this open post: Link

提交回复
热议问题