org.apache.brooklyn.util.time.Time.getTimeZoneOffsetString()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.apache.brooklyn.util.time.Time.getTimeZoneOffsetString()方法的一些代码示例,展示了Time.getTimeZoneOffsetString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Time.getTimeZoneOffsetString()方法的具体详情如下:
包路径:org.apache.brooklyn.util.time.Time
类名称:Time
方法名:getTimeZoneOffsetString

Time.getTimeZoneOffsetString介绍

[英]convert a TimeZone e.g. Europe/London to an offset string as at the given day, e.g. +0100 or +0000 depending daylight savings, absent with nice error if zone unknown
[中]

代码示例

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common

/** convert a TimeZone e.g. Europe/London to an offset string as at the given day, e.g. +0100 or +0000 depending daylight savings,
 * absent with nice error if zone unknown */
public static Maybe<String> getTimeZoneOffsetString(String tz, int year, int month, int day) {
  TimeZone tzz = getTimeZone(tz);
  if (tzz==null) return Maybe.absent("Unknown time zone code: "+tz);
  return Maybe.of(getTimeZoneOffsetString(tzz, year, month, day));
}

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common

Assert.assertEquals("+0100", Time.getTimeZoneOffsetString("Europe/London", 2015, 6, 4).get());
Assert.assertEquals("-0500", Time.getTimeZoneOffsetString("EST", 2015, 1, 4).get());
Assert.assertEquals("-0400", Time.getTimeZoneOffsetString("America/New_York", 2015, 6, 4).get());
Assert.assertEquals("-0500", Time.getTimeZoneOffsetString("America/New_York", 2015, 1, 4).get());
Assert.assertEquals("+0000", Time.getTimeZoneOffsetString("BST", 2015, 1, 4).get());
Assert.assertEquals("+0100", Time.getTimeZoneOffsetString("BST", 2015, 6, 4).get());
Assert.assertEquals("-0400", Time.getTimeZoneOffsetString("EST", 2015, 6, 4).get());
Assert.assertEquals("-0400", Time.getTimeZoneOffsetString("EDT", 2015, 6, 4).get());
Assert.assertEquals("-0500", Time.getTimeZoneOffsetString("EDT", 2015, 1, 4).get());
Assert.assertEquals("-0600", Time.getTimeZoneOffsetString("CST", 2015, 1, 4).get());
Assert.assertEquals("-0700", Time.getTimeZoneOffsetString("MST", 2015, 1, 4).get());
Assert.assertEquals("-0800", Time.getTimeZoneOffsetString("PST", 2015, 1, 4).get());
Assert.assertEquals("+0530", Time.getTimeZoneOffsetString("IST", 2015, 1, 4).get());

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common

tzz = new SimpleTimeZone(offset*1000, tz);
  tz = getTimeZoneOffsetString(tzz, year, month, day);
  result = new GregorianCalendar(tzz);
} else {

代码示例来源:origin: org.apache.brooklyn/brooklyn-utils-common

assertDatesParseToEqual("2015.6.4.0000", "2015-06-04-0000 "+Time.getTimeZoneOffsetString(TimeZone.getDefault(), 2015, 6, 4));
assertDatesParseToEqual("20150604", "2015-06-04-0000");

相关文章