在MyApplication extends Application的onCreate中设置TimeZone值即可全局适用:
/**
* 设置app内全局时区
*/
public void initGlobalTimeZone() {
TimeZone chinaTimeZone = TimeZone.
getTimeZone(
"GMT+8")
;
TimeZone.
setDefault(chinaTimeZone)
;
JodaTimeAndroid.
init(
this)
;
} 配合JodaTime初始化使用效果更佳
JodaTimeAndroid.
init(
this)
;