时区 : America/Mexico_City 中文:美国中部时间(墨西哥城) 的夏令时
方法: (参数为:
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 中文:美国中部时间(墨西哥城) 的夏令时的更多相关文章
- ubuntu设置时区为美国中部时间西六区
查看当前ubuntu系统时区 date -R Fri, Dec :: + 显示的是东八区时间及北京时间 然后输入tzselect 按照提示修改对应时区 本例子修改为美国中部时间 西六区 ~$ tzse ...
- CST时区,MYSQL与JAVA-WEB服务器时间相差13个小时的问题
最近倒腾了一台阿里云主机,打算在上面装点自己的应用.使用docker安装了安装mysql后,发现数据库的存储的时间与java-web应用的时间差8个小时,初步怀疑是docker容器时区的问题.经过一系 ...
- 美国cst时间和夏令时
美国6 PM CST相当于北京时间几点? 换算北京时间是:8:00,上午8点,日期是第二天.(换算公式:18点+14小时=第二天8点) 6 PM CST:6:00 PM Central Standar ...
- jQuery 根据城市时区,选择对应的即时时间
我们的CRM系统中,下面是用jQuery 做了个时区小插件 如图: // 时区城市//$(function(){//所有城市和时间静态输出//var cityID = 170; //中国,北京//va ...
- wget 显示"英国中部时间",去掉烦人的刷屏显示
wget下载文件显示多行,进度条后面显示英国中部时间,非常让人郁闷. 本来英文是eta(Estimated Time of Arrival 预计到达时间),翻译错了,干脆去掉好了. 先要有两个个工具 ...
- 去掉wget烦人的 “eta(英国中部时间)” 提示
gentoo 里的 wget ,从1.12版本开始,就一直有个不影响功能的小毛病:由于中文翻译的失误,进度提示的时候,会被拉成很多行.原因就是原来英文的ETA这3个字母,被翻译成了 “eta(英国中部 ...
- Rails-Treasure chest1 (自定义Model网址;多语言包; 时区设置, TimeZone类; 格式日期时间; 表单单选UI; 表单多选UI;Select2 Plugin)
自定义Model网址: 随机值网址SecureRandom.base58 多语言包, 包括默认语言设置和user自设置. 时区设置, TimeZone类 ,增加user自选时区功能 格式日期时间: x ...
- (转)AIX修改系统时区的3种方法和AIX 时间问题(夏令时)
原文:http://blog.csdn.net/fuwencaho/article/details/28267283 http://www.wo81.com/tec/os/aix/2014-04-30 ...
- flutter showDatePicker显示中文日期_Flutter时间控件显示中文
flutter showDatePicker showTimePicker显示中文日期 1.配置flutter_localizations依赖 找到pubspec.yaml配置flutter_loca ...
随机推荐
- 2013年10月13日学习:SQL通过命令语句来创建表
优点:操作简单,不容易出错,易于调试 缺点:需要记住命令.命令多了就容易混淆,是吧!但是熟悉了时间长了就OK了! step 1. 新建数据库,命名为Test 点击图形化界面中的新建查询,此时就可以输入 ...
- CSS常见选择器
一.元素选择器 p,html,h1, h2 1.多个元素一起设置同一种风格, 则用逗号“,”隔开(选择器分组) 2.通配符选择, *{Color:red} 表示文档中所有元素都为红色 二.类选择器 ...
- APP评价(星星点赞)很简单
1.用代码或者storyboard创建5个button(现在一般都是5个星星) 我用的是storyboard 记得一定要设置button的tag值 在.h中 @property (weak, nona ...
- Telerik柱状图(1)
此随笔主要是介绍一下Telerik的柱状图控件中的一种.效果图为: 此图展示了五个人每个季度的绩效成绩,用图形方式展示数据可以让用户更直观的去看数据,分析数据,不多说了,在这个分享一下我录得视频讲解, ...
- java新手笔记15 多态
1.Animal类 package com.yfs.javase; public class Animal { public void cry() { System.out.println(" ...
- Oracle 10g 默认安装带来的用户名/密码
ORACLE数据库创建的时候,创建了一系列默认的用户和表空间 Oracle 10g 默认安装带来的用户名/密码 Username Password Description See Also CTXSY ...
- 04_过滤器Filter_02_Filter解决中文乱码问题
[过滤器解决中文乱码问题实例] [工程截图] [web.xml] <?xml version="1.0" encoding="UTF-8"?> &l ...
- Codevs 3269 混合背包(二进制优化)
3269 混合背包 时间限制: 1 s 空间限制: 256000 KB 题目等级 : 钻石 Diamond 传送门 题目描述 Description 背包体积为V ,给出N个物品,每个物品占用体积为V ...
- Constants in C++
The first motivation for const seems to have been to eliminate the use of preprocessor #define for v ...
- 原型模式(Prototype Pattern)
原型模型:用于创建重复对象,同时保证性能. 这种模式实现一个原型接口,用于创建对象的克隆,当直接创建对象的代价比较大,则可以采用这种模式.例如:一个对象需要高代价的数据库操作之后被创建,这时可以缓存该 ...