org.joda.time.LocalDate.toLocalDateTime()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(148)

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

LocalDate.toLocalDateTime介绍

[英]Converts this object to a LocalDateTime using a LocalTime to fill in the missing fields.

The resulting chronology is determined by the chronology of this LocalDate. The chronology of the time must also match. If the time is null an exception is thrown.

This instance is immutable and unaffected by this method call.
[中]使用LocalTime来填充缺少的字段,将此对象转换为LocalDateTime。
生成的时间顺序由此LocalDate的时间顺序确定。时间顺序也必须匹配。如果时间为null,则引发异常。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: alibaba/fastjson

if (text.length() == 10 || text.length() == 8) {
  LocalDate localDate = parseLocalDate(text, format, formatter);
  localDateTime = localDate.toLocalDateTime(LocalTime.MIDNIGHT);
} else {
  localDateTime = parseDateTime(text, formatter);

代码示例来源:origin: com.alibaba/fastjson

if (text.length() == 10 || text.length() == 8) {
  LocalDate localDate = parseLocalDate(text, format, formatter);
  localDateTime = localDate.toLocalDateTime(LocalTime.MIDNIGHT);
} else {
  localDateTime = parseDateTime(text, formatter);

代码示例来源:origin: stackoverflow.com

// Ideally use an injectable clock...
LocalDate today = new LocalDate();
// If this is effectively constant, extract it to a final static field
LocalTime time = new LocalTime(1, 0);

// Or use toDateTime(...) depending on what you're trying to accomplish
LocalDateTime todayAtTime = today.toLocalDateTime(time);

相关文章