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

news/2024/10/17 4:53:28/

方法: (参数为:

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-01System.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 dayif ((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]

转载于:https://www.cnblogs.com/xiaorenwu702/p/5112630.html


http://www.ppmy.cn/news/598287.html

相关文章

“我最喜欢的电脑,是一台 31 年前的旧 Mac”

整理 | 郑丽媛 出品 | 程序人生&#xff08;ID&#xff1a;coder_life&#xff09; 说起最喜欢的电脑&#xff0c;很多人的第一反应都是&#xff1a;速度快、内存大、分辨率高……反正不考虑价格因素的话&#xff0c;对于大多数人来说&#xff0c;一般最新款就是最好的。 然而近…

macbook历代_苹果Mac历代重大变革

本周对于苹果来说是非常重要的一周&#xff0c;因为本周是苹果旗下首款笔记本PowerBook发布25周年纪念。在1991年的Comdex展会上&#xff0c;苹果推出了PowerBook 100&#xff0c;其拥有一块9英寸单色背光640 x 400像素分辨率的液晶显示器&#xff0c;不含内置软盘&#xff0c;…

Mac如何实现用快捷键输入当前时间(非常详细,放心食用)

#没有排版&#xff0c;只有干货 需求场景&#xff1a;在notion记录每日日记或者想发时可以快速在文案开头插入开始编写时间&#xff0c;结束时插入结束时间&#xff0c;即需要可以快速插入当前时间 这篇文章是综合了网上已有的信息资源&#xff0c;结合笔者自己的实际操作&am…

macbook苹果电脑新手快速上手

文章目录 系统介绍触摸板教程常用快捷键教程实用软件教程一些实用功能 系统介绍 mac 的系统与 win 的文件管理上的区别 win 的系统最直观的感受就是将磁盘分成了 c 盘&#xff0c;d 盘&#xff0c;e 盘等&#xff0c;但是 mac 系统的文件系统不是如此&#xff0c;它没有 c 盘…

部分 Macbook 发货时间延迟,这是否寓意着Apple Silicon Mac即将面世

近日有网友发现&#xff0c;部分 MacBook Pro 的发货时间已经延迟至 11/12-11/19 日&#xff0c;高配版本的 13 英寸 MacBook Pro 更是推迟到 12/2-12/8 日&#xff1b;部分新款 21.5 英寸 iMac 同样推迟到 12/1-12/8 日收货。 按照惯例&#xff0c;不少网友猜测&#xff0c;这…

macbook历代_苹果2006至2015历代MacBook简要回顾

2006年5月份的时候&#xff0c;苹果悄然取消了12英寸的PowerBook和12/14英寸的iBook机型&#xff0c;取而代之的是13.3英寸的MacBook。作为苹果从PowerPC处理器向Intel迁移的最后一步&#xff0c;该机拥有有黑/白两种颜色。随后&#xff0c;该公司又推出了15和17英寸的MacBook …

macbook 常用键盘快捷键大全 mac os 苹果电脑

为了让刚开始使用 Mac 的新手更快地上手&#xff0c;特整理了这一份“最值得你记住的 Mac 常用快捷键列表”&#xff0c;希望可以帮助到大家更快地学习和查找 macOS 的键盘快捷键&#xff0c;以此提高 Mac 的操作效率…… 与 Windows 的差异 一切开始前&#xff0c;我们先来认识…

软件测试体系之安全测试工具集成方案

DevOps这个概念大家都早已不陌生&#xff0c;该开发模型为企业带来了敏捷的开发效率&#xff0c;帮助企业应对越来越复杂的软件和越来越快的发布频率。但是在这个过程中&#xff0c;安全问题也日益凸显。本文我们跟大家分享一套方案&#xff0c;将安全测试工具集成到DevOps中&a…