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

x33g5p2x  于2022-01-21 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(127)

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

Instant.ofEpochSecond介绍

[英]Obtains an instance of Instant using seconds from the epoch of 1970-01-01T00:00:00Z.

The nanosecond field is set to zero.
[中]从1970-01-01T00:00:00Z的历元中获取使用秒的Instant实例。
纳秒场设置为零。

代码示例

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

@Override
 public Instant apply(FromDecimalArguments a) {
  return Instant.ofEpochSecond(a.integer, a.fraction);
 }
},

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

@Override
 public Instant apply(FromDecimalArguments a) {
  return Instant.ofEpochSecond(a.integer, a.fraction);
 }
},

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

@Override
  public Instant apply(FromDecimalArguments a) {
    return Instant.ofEpochSecond(a.integer, a.fraction);
  }
},

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

/**
 * Converts a {@code java.sql.Timestamp} to an {@code Instant}.
 *
 * @param sqlTimestamp  the SQL timestamp, not null
 * @return the instant, not null
 */
public static Instant toInstant(Timestamp sqlTimestamp) {
  return Instant.ofEpochSecond(sqlTimestamp.getTime() / 1000, sqlTimestamp.getNanos());
}

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

static Instant readExternal(DataInput in) throws IOException {
  long seconds = in.readLong();
  int nanos = in.readInt();
  return Instant.ofEpochSecond(seconds, nanos);
}

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

/**
 * Converts a {@code java.sql.Timestamp} to an {@code Instant}.
 *
 * @param sqlTimestamp  the SQL timestamp, not null
 * @return the instant, not null
 */
public static Instant toInstant(Timestamp sqlTimestamp) {
  return Instant.ofEpochSecond(sqlTimestamp.getTime() / 1000, sqlTimestamp.getNanos());
}

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

static Instant readExternal(DataInput in) throws IOException {
  long seconds = in.readLong();
  int nanos = in.readInt();
  return Instant.ofEpochSecond(seconds, nanos);
}

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

@Override
  public ZonedDateTime apply(FromDecimalArguments a) {
    return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
  }
},

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

@Override
  public OffsetDateTime apply(FromDecimalArguments a) {
    return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
  }
},

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

@Override
 public OffsetDateTime apply(FromDecimalArguments a) {
  return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

@Override
 public OffsetDateTime apply(FromDecimalArguments a) {
  return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

@Override
 public ZonedDateTime apply(FromDecimalArguments a) {
  return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

@Override
 public ZonedDateTime apply(FromDecimalArguments a) {
  return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

@Override
 public ZonedDateTime apply(FromDecimalArguments a) {
  return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

@Override
 public OffsetDateTime apply(FromDecimalArguments a) {
  return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
 }
},

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

/**
 * Converts this date-time to an {@code Instant}.
 * <p>
 * This combines this local date-time and the specified offset to form
 * an {@code Instant}.
 *
 * @param offset  the offset to use for the conversion, not null
 * @return an {@code Instant} representing the same instant, not null
 */
public Instant toInstant(ZoneOffset offset) {
  return Instant.ofEpochSecond(toEpochSecond(offset), toLocalTime().getNano());
}

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

/**
 * Converts this date-time to an {@code Instant}.
 * <p>
 * This combines this local date-time and the specified offset to form
 * an {@code Instant}.
 *
 * @param offset  the offset to use for the conversion, not null
 * @return an {@code Instant} representing the same instant, not null
 */
public Instant toInstant(ZoneOffset offset) {
  return Instant.ofEpochSecond(toEpochSecond(offset), toLocalTime().getNano());
}

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

/**
 * Converts this date-time to an {@code Instant}.
 * <p>
 * This returns an {@code Instant} representing the same point on the
 * time-line as this date-time. The calculation combines the
 * {@linkplain #toLocalDateTime() local date-time} and
 * {@linkplain #getOffset() offset}.
 *
 * @return an {@code Instant} representing the same instant, not null
 */
public Instant toInstant() {
  return Instant.ofEpochSecond(toEpochSecond(), toLocalTime().getNano());
}

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

private void mergeInstantFields0(ZoneId selectedZone) {
  Instant instant = Instant.ofEpochSecond(fieldValues.remove(INSTANT_SECONDS));
  ChronoZonedDateTime<?> zdt = chrono.zonedDateTime(instant, selectedZone);
  if (date == null) {
    addObject(zdt.toLocalDate());
  } else {
    resolveMakeChanges(INSTANT_SECONDS, zdt.toLocalDate());
  }
  addFieldValue(SECOND_OF_DAY, (long) zdt.toLocalTime().toSecondOfDay());
}

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

private void mergeInstantFields0(ZoneId selectedZone) {
  Instant instant = Instant.ofEpochSecond(fieldValues.remove(INSTANT_SECONDS));
  ChronoZonedDateTime<?> zdt = chrono.zonedDateTime(instant, selectedZone);
  if (date == null) {
    addObject(zdt.toLocalDate());
  } else {
    resolveMakeChanges(INSTANT_SECONDS, zdt.toLocalDate());
  }
  addFieldValue(SECOND_OF_DAY, (long) zdt.toLocalTime().toSecondOfDay());
}

相关文章