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

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

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

LocalDateTime.toInstant介绍

暂无

代码示例

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

/**
 * Converts this date-time to an {@code Instant}.
 *
 * @return an {@code Instant} representing the same instant, not null
 */
public Instant toInstant() {
  return dateTime.toInstant(offset);
}

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

/**
 * Converts this date-time to an {@code Instant}.
 *
 * @return an {@code Instant} representing the same instant, not null
 */
public Instant toInstant() {
  return dateTime.toInstant(offset);
}

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

/**
 * Gets the transition instant.
 * <p>
 * This is the instant of the discontinuity, which is defined as the first
 * instant that the 'after' offset applies.
 * <p>
 * The methods {@link #getInstant()}, {@link #getDateTimeBefore()} and {@link #getDateTimeAfter()}
 * all represent the same instant.
 *
 * @return the transition instant, not null
 */
public Instant getInstant() {
  return transition.toInstant(offsetBefore);
}

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

/**
 * Gets the transition instant.
 * <p>
 * This is the instant of the discontinuity, which is defined as the first
 * instant that the 'after' offset applies.
 * <p>
 * The methods {@link #getInstant()}, {@link #getDateTimeBefore()} and {@link #getDateTimeAfter()}
 * all represent the same instant.
 *
 * @return the transition instant, not null
 */
public Instant getInstant() {
  return transition.toInstant(offsetBefore);
}

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

@Nullable
public static Long localDateTimeToLongUtc(@Nullable LocalDateTime d) {
  if (d == null) {
    return null;
  }
  return d.toInstant(ZoneOffset.UTC).toEpochMilli();
}

代码示例来源:origin: com.torodb.kvdocument/mongo-converter

@Override
public BsonValue visit(DateValue value, Void arg) {
  Instant instant = value.getValue().atStartOfDay().toInstant(ZoneOffset.UTC);
  return new BsonDateTime(instant.toEpochMilli());
}

代码示例来源:origin: com.torodb.kvdocument/mongo-converter

@Override
public BsonValue visit(DateTimeValue value, Void arg) {
  Instant instant = value.getValue().toInstant(ZoneOffset.UTC);
  return new BsonTimestamp(
      UnsignedInteger.valueOf(instant.getEpochSecond()).intValue(),
      instant.getNano()
  );
}

相关文章