gpt4 book ai didi

net.time4j.tz.ZonalOffset.parse()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 11:27:31 26 4
gpt4 key购买 nike

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

ZonalOffset.parse介绍

[英]Interpretes a canonical representation as zonal offset.

All string produced by the methods canonical() or toString() are supported. Due to the technical nature of canonical representations this method is not designed to parse any kind of user-defined input, especially the use of GMT-prefix is NOT canonical and outdated from a scientific point of view.

Examples for supported formats:

  • UTC+5
  • UTC+05
  • UTC+5:30
  • UTC+05:30
  • UTC+5:30:21
  • UTC+05:30:21
  • UTC+5:30:21.123456789
  • UTC+05:30:21.123456789
  • +5
  • +05
  • +5:30
  • +05:30
  • +5:30:21
  • +05:30:21
  • +5:30:21.123456789
  • +05:30:21.123456789

Note: All formats containing only the hour or the hour with only one digit are first supported in version 3.1 or later.
[中]将规范表示解释为纬向偏移。
支持canonical()或toString()方法生成的所有字符串。由于规范表示法的技术性质,该方法不用于解析任何类型的用户定义输入,尤其是从科学角度来看,GMT前缀的使用不规范且过时。
支持的格式示例:
*UTC+5
*UTC+05
*UTC+5:30
*UTC+05:30
*UTC+5:30:21
*UTC+05:30:21
*UTC+5:30:21.123456789
*UTC+05:30:21.123456789

  • +5
  • +05
  • +5:30
  • +05:30
  • +5:30:21
  • +05:30:21
  • +5:30:21.123456789
  • +05:30:21.123456789
    注:3.1版或更高版本首先支持仅包含小时或仅含一位数字的小时的所有格式。

代码示例

代码示例来源:origin: net.time4j/time4j-core

return parse(canonical, true);

代码示例来源:origin: net.time4j/time4j-core

private static TZID resolve(String zoneKey) {
  // enums bevorzugen
  TZID resolved = PREDEFINED.get(zoneKey);
  if (resolved == null) {
    if (zoneKey.startsWith("GMT")) {
      zoneKey = "UTC" + zoneKey.substring(3);
    }
    resolved = ZonalOffset.parse(zoneKey, false);
    if (resolved == null) {
      resolved = new NamedID(zoneKey);
    }
  }
  return resolved;
}

代码示例来源:origin: net.time4j/time4j-core

int hours = parse(test, 1, 2);
  int minutes = parse(test, start, 2);
      && (test.charAt(start + 2) == ':')
    ) {
      int seconds = parse(test, start + 3, 2);
      if (seconds >= 0) {
        int total = hours * 3600 + minutes * 60 + seconds;
          && (test.charAt(start + 5) == '.')
        ) {
          int fraction = parse(test, start + 6, 9);
          if (fraction >= 0) {
            if (sign == OffsetSign.BEHIND_UTC) {

代码示例来源:origin: net.time4j/time4j-range

remainder = remainder.substring(0, 3) + ":" + remainder.substring(3);
offset = ZonalOffset.parse(remainder);
break;

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com