本文整理了Java中org.threeten.bp.LocalDateTime.toLocalDate()
方法的一些代码示例,展示了LocalDateTime.toLocalDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDateTime.toLocalDate()
方法的具体详情如下:
包路径:org.threeten.bp.LocalDateTime
类名称:LocalDateTime
方法名:toLocalDate
[英]Gets the LocalDate part of this date-time.
This returns a LocalDate with the same year, month and day as this date-time.
[中]获取此日期时间的LocalDate部分。
这将返回与此日期时间相同的年、月和日的LocalDate。
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the {@code LocalDate} part of this date-time.
* <p>
* This returns a {@code LocalDate} with the same year, month and day
* as this date-time.
*
* @return the date part of this date-time, not null
*/
@Override // override for return type
public LocalDate toLocalDate() {
return dateTime.toLocalDate();
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the {@code LocalDate} part of this date-time.
* <p>
* This returns a {@code LocalDate} with the same year, month and day
* as this date-time.
*
* @return the date part of this date-time, not null
*/
@Override // override for return type
public LocalDate toLocalDate() {
return dateTime.toLocalDate();
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the {@code LocalDate} part of this date-time.
* <p>
* This returns a {@code LocalDate} with the same year, month and day
* as this date-time.
*
* @return the date part of this date-time, not null
*/
public LocalDate toLocalDate() {
return dateTime.toLocalDate();
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the {@code LocalDate} part of this date-time.
* <p>
* This returns a {@code LocalDate} with the same year, month and day
* as this date-time.
*
* @return the date part of this date-time, not null
*/
public LocalDate toLocalDate() {
return dateTime.toLocalDate();
}
代码示例来源:origin: apache/servicemix-bundles
@Nonnull
@Override
public LocalDate convert(Date source) {
return ofInstant(ofEpochMilli(source.getTime()), systemDefault()).toLocalDate();
}
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Queries this date-time using the specified query.
* <p>
* This queries this date-time using the specified query strategy object.
* The {@code TemporalQuery} object defines the logic to be used to
* obtain the result. Read the documentation of the query to understand
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
* @param query the query to invoke, not null
* @return the query result, null may be returned (defined by the query)
* @throws DateTimeException if unable to query (defined by the query)
* @throws ArithmeticException if numeric overflow occurs (defined by the query)
*/
@SuppressWarnings("unchecked")
@Override // override for Javadoc
public <R> R query(TemporalQuery<R> query) {
if (query == TemporalQueries.localDate()) {
return (R) toLocalDate();
}
return super.query(query);
}
代码示例来源:origin: ThreeTen/threetenbp
private int compareTo0(LocalDateTime other) {
int cmp = date.compareTo0(other.toLocalDate());
if (cmp == 0) {
cmp = time.compareTo(other.toLocalTime());
}
return cmp;
}
代码示例来源:origin: org.threeten/threetenbp
private int compareTo0(LocalDateTime other) {
int cmp = date.compareTo0(other.toLocalDate());
if (cmp == 0) {
cmp = time.compareTo(other.toLocalTime());
}
return cmp;
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Queries this date-time using the specified query.
* <p>
* This queries this date-time using the specified query strategy object.
* The {@code TemporalQuery} object defines the logic to be used to
* obtain the result. Read the documentation of the query to understand
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
* {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
* @param query the query to invoke, not null
* @return the query result, null may be returned (defined by the query)
* @throws DateTimeException if unable to query (defined by the query)
* @throws ArithmeticException if numeric overflow occurs (defined by the query)
*/
@SuppressWarnings("unchecked")
@Override // override for Javadoc
public <R> R query(TemporalQuery<R> query) {
if (query == TemporalQueries.localDate()) {
return (R) toLocalDate();
}
return super.query(query);
}
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
return LocalDateTime.ofInstant(Instant.parse(string), ZoneOffset.UTC).toLocalDate();
} else {
return LocalDate.parse(string, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
代码示例来源:origin: org.threeten/threetenbp
return resolveLocal(LocalDateTime.of((LocalDate) adjuster, dateTime.toLocalTime()));
} else if (adjuster instanceof LocalTime) {
return resolveLocal(LocalDateTime.of(dateTime.toLocalDate(), (LocalTime) adjuster));
} else if (adjuster instanceof LocalDateTime) {
return resolveLocal((LocalDateTime) adjuster);
代码示例来源:origin: ThreeTen/threetenbp
return resolveLocal(LocalDateTime.of((LocalDate) adjuster, dateTime.toLocalTime()));
} else if (adjuster instanceof LocalTime) {
return resolveLocal(LocalDateTime.of(dateTime.toLocalDate(), (LocalTime) adjuster));
} else if (adjuster instanceof LocalDateTime) {
return resolveLocal((LocalDateTime) adjuster);
内容来源于网络,如有侵权,请联系作者删除!