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

x33g5p2x  于2022-02-05 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(110)

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

ZonedDateTime.from介绍

[英]Obtains an instance of ZonedDateTime from a temporal object.

A TemporalAccessor represents some form of date and time information. This factory converts the arbitrary temporal object to an instance of ZonedDateTime.

The conversion will first obtain a ZoneId. It will then try to obtain an instant. If that fails it will try to obtain a local date-time. The zoned date time will either be a combination of ZoneId and instant, or ZoneId and local date-time.

This method matches the signature of the functional interface TemporalQueryallowing it to be used in queries via method reference, ZonedDateTime::from.
[中]从时间对象获取ZoneDateTime的实例。
临时助理代表某种形式的日期和时间信息。此工厂将任意时间对象转换为ZoneDateTime的实例。
转换将首先获得ZoneId。然后,它将尝试获得一个瞬间。如果失败,它将尝试获取本地日期和时间。分区日期时间可以是ZoneId和instant的组合,也可以是ZoneId和本地日期时间的组合。
此方法匹配函数接口TemporalQueryLow的签名,通过方法引用ZonedDateTime::from将其用于查询。

代码示例

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

@Override
  public ZonedDateTime queryFrom(TemporalAccessor temporal) {
    return ZonedDateTime.from(temporal);
  }
};

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

@Override
  public ZonedDateTime queryFrom(TemporalAccessor temporal) {
    return ZonedDateTime.from(temporal);
  }
};

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

/**
 * Obtains an ISO zoned date-time from another date-time object.
 * <p>
 * This is equivalent to {@link ZonedDateTime#from(TemporalAccessor)}.
 *
 * @param temporal  the date-time object to convert, not null
 * @return the ISO zoned date-time, not null
 * @throws DateTimeException if unable to create the date-time
 */
@Override  // override with covariant return type
public ZonedDateTime zonedDateTime(TemporalAccessor temporal) {
  return ZonedDateTime.from(temporal);
}

代码示例来源:origin: mercadolibre/java-sdk

@Override
 public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
  return ZonedDateTime.from(temporalAccessor);
 }
},

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

@Override
  public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
    return ZonedDateTime.from(temporalAccessor);
  }
},

代码示例来源:origin: gengstrand/clojure-news-feed

@Override
 public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
  return ZonedDateTime.from(temporalAccessor);
 }
},

代码示例来源:origin: XeroAPI/Xero-Java

@Override
 public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
  return ZonedDateTime.from(temporalAccessor);
 }
},

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

/**
 * Obtains an ISO zoned date-time from another date-time object.
 * <p>
 * This is equivalent to {@link ZonedDateTime#from(TemporalAccessor)}.
 *
 * @param temporal  the date-time object to convert, not null
 * @return the ISO zoned date-time, not null
 * @throws DateTimeException if unable to create the date-time
 */
@Override  // override with covariant return type
public ZonedDateTime zonedDateTime(TemporalAccessor temporal) {
  return ZonedDateTime.from(temporal);
}

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

ZonedDateTime end = ZonedDateTime.from(endExclusive);
if (unit instanceof ChronoUnit) {
  end = end.withZoneSameInstant(zone);

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

ZonedDateTime end = ZonedDateTime.from(endExclusive);
if (unit instanceof ChronoUnit) {
  end = end.withZoneSameInstant(zone);

相关文章