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

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

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

LocalDate.atStartOfDay介绍

[英]Combines this date with the time of midnight to create a LocalDateTimeat the start of this date.

This returns a LocalDateTime formed from this date at the time of midnight, 00:00, at the start of this date.
[中]将此日期与午夜时间相结合,以在此日期开始时创建LocalDateTime。
这将返回从该日期开始的午夜00:00开始形成的LocalDateTime。

代码示例

代码示例来源:origin: apache/servicemix-bundles

@Nonnull
  @Override
  public Date convert(LocalDate source) {
    return toDate(source.atStartOfDay(systemDefault()).toInstant());
  }
}

代码示例来源:origin: Krillsson/sys-API

default java.util.Date map(org.threeten.bp.LocalDate value) {
    return value != null ? DateTimeUtils.toDate(value.atStartOfDay(ZoneId.systemDefault()).toInstant()) : null;
  }
}

代码示例来源: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: Ullink/simple-slack-api

@Override
public List<SlackMessagePosted> fetchHistoryOfChannel(String channelId, LocalDate day, int numberOfMessages, Set<String> allowedSubtypes) {
  Map<String, String> params = new HashMap<>();
  params.put("channel", channelId);
  if (day != null) {
    ZonedDateTime start = ZonedDateTime.of(day.atStartOfDay(), ZoneId.of("UTC"));
    ZonedDateTime end = ZonedDateTime.of(day.atStartOfDay().plusDays(1).minus(1, ChronoUnit.MILLIS), ZoneId.of("UTC"));
    params.put("oldest", convertDateToSlackTimestamp(start));
    params.put("latest", convertDateToSlackTimestamp(end));
  }
  if (numberOfMessages > -1) {
    params.put("count", String.valueOf(numberOfMessages));
  } else {
    params.put("count", String.valueOf(DEFAULT_HISTORY_FETCH_SIZE));
  }
  SlackChannel channel = session.findChannelById(channelId);
  switch (channel.getType()) {
    case INSTANT_MESSAGING:
      return fetchHistoryOfChannel(params,FETCH_IM_HISTORY_COMMAND, allowedSubtypes);
    case PRIVATE_GROUP:
      return fetchHistoryOfChannel(params,FETCH_GROUP_HISTORY_COMMAND, allowedSubtypes);
    default:
      return fetchHistoryOfChannel(params,FETCH_CHANNEL_HISTORY_COMMAND, allowedSubtypes);
  }
}

相关文章