方法:TimeZone.getDefault().getDisplayName(true, TimeZone.SHORT);
获取的值如GMT+08:00,GMT-04:00,EDT  另附:
国家码查询网址:http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
时区查询网址:https://en.wikipedia.org/wiki/List_of_tz_database_time_zones 说明:
参加源码TimeZone.java
public final String getDisplayName() {
return getDisplayName(false, LONG, Locale.getDefault());
}
public final String getDisplayName(Locale locale) {
return getDisplayName(false, LONG, locale);
}
public final String getDisplayName(boolean daylightTime, int style) {
return getDisplayName(daylightTime, style, Locale.getDefault());
} /**
* Returns the {@link #SHORT short} or {@link #LONG long} name of this time
* zone with either standard or daylight time, as written in {@code locale}.
* If the name is not available, the result is in the format
* {@code GMT[+-]hh:mm}.
*
* @param daylightTime true for daylight time, false for standard time.
* @param style either {@link TimeZone#LONG} or {@link TimeZone#SHORT}.
* @param locale the display locale.
*/
public String getDisplayName(boolean daylightTime, int style, Locale locale) {
if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Bad style: " + style);
} String[][] zoneStrings = TimeZoneNames.getZoneStrings(locale);
String result = TimeZoneNames.getDisplayName(zoneStrings, getID(), daylightTime, style);
if (result != null) {
return result;
} // If we get here, it's because icu4c has nothing for us. Most commonly, this is in the
// case of short names. For Pacific/Fiji, for example, icu4c has nothing better to offer
// than "GMT+12:00". Why do we re-do this work ourselves? Because we have up-to-date
// time zone transition data, which icu4c _doesn't_ use --- it uses its own baked-in copy,
// which only gets updated when we update icu4c. http://b/7955614 and http://b/8026776. // TODO: should we generate these once, in TimeZoneNames.getDisplayName? Revisit when we
// upgrade to icu4c 50 and rewrite the underlying native code. See also the
// "element[j] != null" check in SimpleDateFormat.parseTimeZone, and the extra work in
// DateFormatSymbols.getZoneStrings.
int offsetMillis = getRawOffset();
if (daylightTime) {
offsetMillis += getDSTSavings();
}
return createGmtOffsetString(true /* includeGmt */, true /* includeMinuteSeparator */,
offsetMillis);
}
public int getDSTSavings() {
return useDaylightTime() ? 3600000 : 0;
}
/**
* Returns the offset in milliseconds from UTC of this time zone's standard
* time.
*/
public abstract int getRawOffset();

[Android]如何获取当前用户设置的时区的更多相关文章

  1. Python 调用datetime或者time获取时间的时候以及时间转换,最好设置一下时区 否则会出现相差8个小时的情况

    在使用调用datetime或者time获取时间的时候以及时间转换,最好设置一下时区, 因为不同机器设置的时区不同,获取的时间可能就不对,正好我们使用的这两个服务器使用的都是东八区,所以没有问题,设置方 ...

  2. MTK Android中设置默认时区

    设置默认时区 PRODUCT_PROPERTY_OVERRIDES += \ persist.sys.timezone=Asia/Shanghai\ 注:搜索“persist.sys.timezone ...

  3. Android Permissions管理之用户拒绝授权

    Android Permissions管理之用户拒绝授权,在Marshmallow之前的安卓版本,应用的权限只需要注册一下,应用就会获取到,在Marshmallow之后,为了安全,全新的权限模型出现, ...

  4. android中获取root权限的方法以及原理(转)

    一. 概述 本文介绍了android中获取root权限的方法以及原理,让大家对android 玩家中常说的“越狱”有一个更深层次的认识. 二. Root 的介绍 1. Root 的目的 可以让我们拥有 ...

  5. Android中获取系统上安装的APP信息

    Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:00000099 EndFragment:00003259 Android中获取系统上安装的APP信 ...

  6. Android中获取正在运行的服务-------ActivityManager.RunningServiceInfo的使用

    关于PackageManager和ActivityManager的使用 ,自己也写了一些DEMO 了,基本上写的线路参考了Settings模块下的 应用程序,大家如果真正的有所兴趣,建议大家看看源码, ...

  7. 与安卓联调,调用安卓那边的方法,获取到安卓传过来的数据,再携带这些数据发送axios请求,获取到用户的信息

    第一步:js调用Android方法:接收Android传递过来的数据,并做处理 //参数一:调用java中的方法   submitFromWeb是方法名,必须和Android中注册时候的方法名称保持一 ...

  8. ASP.NET MVC+EF框架+EasyUI实现权限管理系列(22)-为用户设置角色

    ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇)   (1):框架搭建    (2):数据库访问层的设计Demo    (3):面向接口编程   (4 ):业务逻辑层的封装    ...

  9. 使用腾讯开发平台获取QQ用户数据资料

    <今天是七夕:祝大家七夕嗨皮,前可么么哒,后可啪啪啪> Tips:本篇博客将教你如何使用腾讯开发平台获取QQ用户资料 ----------------------------------- ...

随机推荐

  1. hdu5072 Coprime (2014鞍山区域赛C题)(数论)

    http://acm.hdu.edu.cn/showproblem.php?pid=5072 题意:给出N个数,求有多少个三元组,满足三个数全部两两互质或全部两两不互质. 题解: http://dty ...

  2. 解析posix与perl标准的正则表达式区别 ---PHP

        正则表达式(Regular Expression,缩写为regexp,regex或regxp),又称正规表达式.正规表示式或常规表达式或正规化表示法或正规表示法,是指一个用 来描述或者匹配一系 ...

  3. Access应用笔记<二>

    关于access的应用笔记 20140822 基本完成access数据库的搭建,并且尝试了查重,不匹配项目查找,以及上传新数据等功能,表现良好. 记录一下目前研究出来的sql语句: 1)去除重复项 S ...

  4. HDOJ 4768 Flyer

    二分.... Flyer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  5. getField方法

    getField方法是ThinkPHP中用来获取字段值的方法,区别于select和find方法,通常仅用于获取个别字段的值.但是事实上并没有那么简单,该方法的用法总结如下: 获取某个字段值这个是get ...

  6. STM32F10xx CAN BUS相关库文件"stm32f10x_can.c"内的库函数解析

    一.背景: 还是继续CAN通信,要节省开发时间,使用库函数可大大降低开发周期,并且还能确保寄存器的配置几 乎是万无一失,所以,在此就STM32F10xx的CAN操作库函数的使用做个简析. STM32有 ...

  7. Nginx的作用

    负载均衡 现在几乎看不到单机奋斗的应用了吧.反向代理服务器可以根据负载均衡算法进行均匀或者自定义的转发.常见的负载均衡算法有:轮转算法(Round Robin).最少连接算法(Least Connec ...

  8. Android快速开发系列 10个常用工具类

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38965311,本文出自[张鸿洋的博客] 打开大家手上的项目,基本都会有一大批的辅 ...

  9. 深入理解Java虚拟机之读书笔记三 内存分配策略

    一般的内存分配是指堆上的分配,但也可能经过JIT编译后被拆散为标量类型并间接地在栈上分配.对象主要分配在新生代的Eden区上,如果启动了本地线程分配缓冲,将按线程优先在TLAB上分配,少数情况下直接分 ...

  10. BZOJ2843——极地旅行社

    1.题目大意:动态树问题,点修改,链查询.另外说明双倍经验题=bzoj1180 2.分析:lct模板题,练手的 #include <stack> #include <cstdio&g ...