org.threeten.bp.LocalTime.parse()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(182)

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

LocalTime.parse介绍

[英]Obtains an instance of LocalTime from a text string such as 10:15.

The string must represent a valid time and is parsed using org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_TIME.
[中]从文本字符串(如10:15)获取LocalTime的实例。
字符串必须表示有效时间,并使用org解析。三十。英国石油公司。总体安排DateTimeFormatter#ISO#本地时间。

代码示例

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Obtains an instance of {@code LocalTime} from a text string such as {@code 10:15}.
 * <p>
 * The string must represent a valid time and is parsed using
 * {@link org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_TIME}.
 *
 * @param text the text to parse such as "10:15:30", not null
 * @return the parsed local time, not null
 * @throws DateTimeParseException if the text cannot be parsed
 */
public static LocalTime parse(CharSequence text) {
  return parse(text, DateTimeFormatter.ISO_LOCAL_TIME);
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Obtains an instance of {@code LocalTime} from a text string such as {@code 10:15}.
 * <p>
 * The string must represent a valid time and is parsed using
 * {@link org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_TIME}.
 *
 * @param text the text to parse such as "10:15:30", not null
 * @return the parsed local time, not null
 * @throws DateTimeParseException if the text cannot be parsed
 */
public static LocalTime parse(CharSequence text) {
  return parse(text, DateTimeFormatter.ISO_LOCAL_TIME);
}

代码示例来源:origin: jeffdcamp/dbtools-android

@Nullable
public static LocalTime dbStringToLocalTime(@Nullable String text) {
  if (text != null && text.length() > 0 && !text.equals("null")) {
    try {
      return LocalTime.parse(text, DB_TIME_FORMATTER310);
    } catch (Exception ex) {
      throw new IllegalArgumentException("Cannot parse time text: " + text, ex);
    }
  } else {
    return null;
  }
}

代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp

@Override
protected LocalTime deserialize(String key, DeserializationContext ctxt) throws IOException {
  try {
    return LocalTime.parse(key, DateTimeFormatter.ISO_LOCAL_TIME);
  } catch (DateTimeException e) {
    return _rethrowDateTimeException(ctxt, LocalTime.class, e, key);
  }
}

代码示例来源:origin: com.torodb.torod.backends/common

@Override
  public ScalarTime fromJsonValue(JsonString value) {
    return new LocalTimeScalarTime(LocalTime.parse(value.toString()));
  }
}

代码示例来源:origin: com.torodb.torod.backends/common

@Override
public ScalarTime toValue(String value) {
  return new LocalTimeScalarTime(LocalTime.parse(value));
}

相关文章