时区转换_1

时区转换_1悉尼当前时间 2018 09 21 00 00 00 悉尼时区 GMT 10 时间戳 格林尼治时间 00 北京时间 2018 09 20 22 00 00 根据当前时区的时间转换为时间戳方法 public static Date

大家好,我是讯享网,很高兴认识大家。

悉尼当前时间:2018/09/21 00:00:00  

悉尼时区:GMT+10  

时间戳(格林尼治时间):00  

北京时间:2018/09/20 22:00:00

根据当前时区的时间转换为时间戳方法:


讯享网

public static Date convertTimeZoneToDate(String time, String dateFormat, String timeZone) { SimpleDateFormat bjSdf = new SimpleDateFormat(dateFormat); bjSdf.setTimeZone(TimeZone.getTimeZone(timeZone)); try { Date result = bjSdf.parse(time); logger.info("time: {},dateFormat:{},timeZone:{},timestamp:{}", time, dateFormat, timeZone, result.getTime()); return result; } catch (ParseException e) { logger.error("toTimeZone failed!time: {},dateFormat:{},timeZone:{},e:{}", time, dateFormat, timeZone, e); throw new RuntimeException("toTimeZone failed"); } }

讯享网

 

参考:

悉尼时区转换:https://www.epochconverter.com/timezones?q=&tz=Australia%2FSydney

北京时间时间戳转换:http://tool.chinaz.com/Tools/unixtime.aspx

小讯
上一篇 2025-03-03 20:45
下一篇 2025-03-08 19:43

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/125553.html