方法: (参数为:

TimeZone timeZone = TimeZone.getTimeZone("America/Mexico_City");
private static void testDayTime(TimeZone timeZone) {
System.out.println("Time Zone is : " + timeZone.getDisplayName() + " : " + timeZone.getID()); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar start = Calendar.getInstance(timeZone);
start.setTime(new Date(0)); // UTC 1970-01-01
System.out.println("start=" + df.format(start.getTime())); // will print: start=1970-01-01 08:00:00 Calendar end = Calendar.getInstance(timeZone);
end.add(Calendar.YEAR, 5);
System.out.println("end=" + df.format(end.getTime())); boolean find = false;
for (long i = start.getTimeInMillis(); i < end.getTimeInMillis(); i = start.getTimeInMillis()) {
start.add(Calendar.DATE, 1); // add one day if ((start.getTimeInMillis() - i) % (24 * 3600 * 1000L) != 0) { // 是否能被24整除
find = true; System.out.println("from " + df.format(new Date(i)) + " to " + df.format(start.getTime()) + " has "
+ (start.getTimeInMillis() - i) + "ms" + "[" + (start.getTimeInMillis() - i) / (3600 * 1000L)
+ "hours]");
} } if (!find) {
System.out.println("Every day is ok.");
}
}

I: Time Zone is : Central Standard Time : America/Mexico_City
I: start=1969-12-31 18:00:00
I: end=2021-01-07 21:24:34
I: from 1996-04-06 18:00:00 to 1996-04-07 18:00:00 has 82800000ms[23hours]
I: from 1996-10-26 18:00:00 to 1996-10-27 18:00:00 has 90000000ms[25hours]
I: from 1997-04-05 18:00:00 to 1997-04-06 18:00:00 has 82800000ms[23hours]
I: from 1997-10-25 18:00:00 to 1997-10-26 18:00:00 has 90000000ms[25hours]
I: from 1998-04-04 18:00:00 to 1998-04-05 18:00:00 has 82800000ms[23hours]
I: from 1998-10-24 18:00:00 to 1998-10-25 18:00:00 has 90000000ms[25hours]
I: from 1999-04-03 18:00:00 to 1999-04-04 18:00:00 has 82800000ms[23hours]
I: from 1999-10-30 18:00:00 to 1999-10-31 18:00:00 has 90000000ms[25hours]
I: from 2000-04-01 18:00:00 to 2000-04-02 18:00:00 has 82800000ms[23hours]
I: from 2000-10-28 18:00:00 to 2000-10-29 18:00:00 has 90000000ms[25hours]
I: from 2001-05-05 18:00:00 to 2001-05-06 18:00:00 has 82800000ms[23hours]
I: from 2001-09-29 18:00:00 to 2001-09-30 18:00:00 has 90000000ms[25hours]
I: from 2002-04-06 18:00:00 to 2002-04-07 18:00:00 has 82800000ms[23hours]
I: from 2002-10-26 18:00:00 to 2002-10-27 18:00:00 has 90000000ms[25hours]
I: from 2003-04-05 18:00:00 to 2003-04-06 18:00:00 has 82800000ms[23hours]
I: from 2003-10-25 18:00:00 to 2003-10-26 18:00:00 has 90000000ms[25hours]
I: from 2004-04-03 18:00:00 to 2004-04-04 18:00:00 has 82800000ms[23hours]
I: from 2004-10-30 18:00:00 to 2004-10-31 18:00:00 has 90000000ms[25hours]
I: from 2005-04-02 18:00:00 to 2005-04-03 18:00:00 has 82800000ms[23hours]
I: from 2005-10-29 18:00:00 to 2005-10-30 18:00:00 has 90000000ms[25hours]
I: from 2006-04-01 18:00:00 to 2006-04-02 18:00:00 has 82800000ms[23hours]
I: from 2006-10-28 18:00:00 to 2006-10-29 18:00:00 has 90000000ms[25hours]
I: from 2007-03-31 18:00:00 to 2007-04-01 18:00:00 has 82800000ms[23hours]
I: from 2007-10-27 18:00:00 to 2007-10-28 18:00:00 has 90000000ms[25hours]
I: from 2008-04-05 18:00:00 to 2008-04-06 18:00:00 has 82800000ms[23hours]
I: from 2008-10-25 18:00:00 to 2008-10-26 18:00:00 has 90000000ms[25hours]
I: from 2009-04-04 18:00:00 to 2009-04-05 18:00:00 has 82800000ms[23hours]
I: from 2009-10-24 18:00:00 to 2009-10-25 18:00:00 has 90000000ms[25hours]
I: from 2010-04-03 18:00:00 to 2010-04-04 18:00:00 has 82800000ms[23hours]
I: from 2010-10-30 18:00:00 to 2010-10-31 18:00:00 has 90000000ms[25hours]
I: from 2011-04-02 18:00:00 to 2011-04-03 18:00:00 has 82800000ms[23hours]
I: from 2011-10-29 18:00:00 to 2011-10-30 18:00:00 has 90000000ms[25hours]
I: from 2012-03-31 18:00:00 to 2012-04-01 18:00:00 has 82800000ms[23hours]
I: from 2012-10-27 18:00:00 to 2012-10-28 18:00:00 has 90000000ms[25hours]
I: from 2013-04-06 18:00:00 to 2013-04-07 18:00:00 has 82800000ms[23hours]
I: from 2013-10-26 18:00:00 to 2013-10-27 18:00:00 has 90000000ms[25hours]
I: from 2014-04-05 18:00:00 to 2014-04-06 18:00:00 has 82800000ms[23hours]
I: from 2014-10-25 18:00:00 to 2014-10-26 18:00:00 has 90000000ms[25hours]
I: from 2015-04-04 18:00:00 to 2015-04-05 18:00:00 has 82800000ms[23hours]
I: from 2015-10-24 18:00:00 to 2015-10-25 18:00:00 has 90000000ms[25hours]
I: from 2016-04-02 18:00:00 to 2016-04-03 18:00:00 has 82800000ms[23hours]
I: from 2016-10-29 18:00:00 to 2016-10-30 18:00:00 has 90000000ms[25hours]
I: from 2017-04-01 18:00:00 to 2017-04-02 18:00:00 has 82800000ms[23hours]
I: from 2017-10-28 18:00:00 to 2017-10-29 18:00:00 has 90000000ms[25hours]
I: from 2018-03-31 18:00:00 to 2018-04-01 18:00:00 has 82800000ms[23hours]
I: from 2018-10-27 18:00:00 to 2018-10-28 18:00:00 has 90000000ms[25hours]
I: from 2019-04-06 18:00:00 to 2019-04-07 18:00:00 has 82800000ms[23hours]
I: from 2019-10-26 18:00:00 to 2019-10-27 18:00:00 has 90000000ms[25hours]
I: from 2020-04-04 18:00:00 to 2020-04-05 18:00:00 has 82800000ms[23hours]
I: from 2020-10-24 18:00:00 to 2020-10-25 18:00:00 has 90000000ms[25hours]

时区 : America/Mexico_City 中文:美国中部时间(墨西哥城) 的夏令时的更多相关文章

  1. ubuntu设置时区为美国中部时间西六区

    查看当前ubuntu系统时区 date -R Fri, Dec :: + 显示的是东八区时间及北京时间 然后输入tzselect 按照提示修改对应时区 本例子修改为美国中部时间 西六区 ~$ tzse ...

  2. CST时区,MYSQL与JAVA-WEB服务器时间相差13个小时的问题

    最近倒腾了一台阿里云主机,打算在上面装点自己的应用.使用docker安装了安装mysql后,发现数据库的存储的时间与java-web应用的时间差8个小时,初步怀疑是docker容器时区的问题.经过一系 ...

  3. 美国cst时间和夏令时

    美国6 PM CST相当于北京时间几点? 换算北京时间是:8:00,上午8点,日期是第二天.(换算公式:18点+14小时=第二天8点) 6 PM CST:6:00 PM Central Standar ...

  4. jQuery 根据城市时区,选择对应的即时时间

    我们的CRM系统中,下面是用jQuery 做了个时区小插件 如图: // 时区城市//$(function(){//所有城市和时间静态输出//var cityID = 170; //中国,北京//va ...

  5. wget 显示"英国中部时间",去掉烦人的刷屏显示

    wget下载文件显示多行,进度条后面显示英国中部时间,非常让人郁闷. 本来英文是eta(Estimated Time of Arrival 预计到达时间),翻译错了,干脆去掉好了. 先要有两个个工具 ...

  6. 去掉wget烦人的 “eta(英国中部时间)” 提示

    gentoo 里的 wget ,从1.12版本开始,就一直有个不影响功能的小毛病:由于中文翻译的失误,进度提示的时候,会被拉成很多行.原因就是原来英文的ETA这3个字母,被翻译成了 “eta(英国中部 ...

  7. Rails-Treasure chest1 (自定义Model网址;多语言包; 时区设置, TimeZone类; 格式日期时间; 表单单选UI; 表单多选UI;Select2 Plugin)

    自定义Model网址: 随机值网址SecureRandom.base58 多语言包, 包括默认语言设置和user自设置. 时区设置, TimeZone类 ,增加user自选时区功能 格式日期时间: x ...

  8. (转)AIX修改系统时区的3种方法和AIX 时间问题(夏令时)

    原文:http://blog.csdn.net/fuwencaho/article/details/28267283 http://www.wo81.com/tec/os/aix/2014-04-30 ...

  9. flutter showDatePicker显示中文日期_Flutter时间控件显示中文

    flutter showDatePicker showTimePicker显示中文日期 1.配置flutter_localizations依赖 找到pubspec.yaml配置flutter_loca ...

随机推荐

  1. 在List中找出最大值的两种方法

    先说需求:找出一个对象List中,某个属性值最大的对象. 1.定义对象 private class A { public int ID { get; set; } public string Name ...

  2. Bye 14 Hello 15

         打开博客.空间 窥探到大家都在写自己的2014,抬头一看日历2015已近在咫尺了,看着别人的成长(例如 今年看了多少书.做了什么项目.工资涨了多少.职位角色的变化.去了多少地方.还有一些发善 ...

  3. EF中使用语句 或存储过程 查询(转)

    EF中使用语句 或存储过程 查询 1.无参数查询 var model = db.Database.SqlQuery("select* from UserInfoes ").ToLi ...

  4. sql的临时表使用小结

    1.创建方法: 方法一:create table TempTableName或select [字段1,字段2,...,] into TempTableName from table 方法二:creat ...

  5. 05_天气查询_JAX-WS方式_客户端

    [客户端特点] 支持面向对象开发. 客户端功能调用webService,首先得知道WebService的地址. 一般情况下,只要知道了wsdl的地址,就可以知道WebService的地址. 我们上一篇 ...

  6. 用ContentProvider向系统增加联系人

    发现对系统的联系人进行操作的api很乱,感觉逻辑有点不清楚...... 主要用到这4个类: android.provider.ContactsContract.CommonDataKinds.Emai ...

  7. (转)UIColor 的使用

    os开发-UIColor的使用. 在ios开发中,经常遇到对UIColor的相关操作. 比如这样 self.backgroundColor = [UIColorredColor]; 这里的redCol ...

  8. (redis缓存更新策略)postgres 9.4.1 && redis 3.7.0 && redis_fdw_REL9_4_STABLE

    首先下载redis_fdw,这里要注意下载的版本.(https://github.com/pg-redis-fdw/redis_fdw) 一开始,我下载了REL9_4_STABLE_pre2.8版本, ...

  9. 《sort命令的k选项大讨论》-linux命令五分钟系列之二十七

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...

  10. linux下安装phpredis

    一.redis安装 1. yum install redis (不行的先执行:yum install epel-release,再yum install redis) 2.启动服务 redis-ser ...