本文整理了Java中org.threeten.bp.OffsetDateTime.toLocalDate()
方法的一些代码示例,展示了OffsetDateTime.toLocalDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.toLocalDate()
方法的具体详情如下:
包路径:org.threeten.bp.OffsetDateTime
类名称:OffsetDateTime
方法名: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: guanpj/JReadHub
@Override
public void bindData(RelevantTopicBean relevantTopicBean, int position) {
mRelevantTopicBean = relevantTopicBean;
LocalDate date = relevantTopicBean.getCreatedAt().toLocalDate();
int year = date.getYear();
int month = date.getMonthValue();
int day = date.getDayOfMonth();
if (year == OffsetDateTime.now().getYear()) {
mTxtDate.setText(mContext.getString(R.string.month__day, month, day));
} else {
SpannableString spannableTitle = SpannableString.valueOf(mContext.getString(R.string.month__day__year, month, day, year));
spannableTitle.setSpan(new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.text_topic_detail_news_author)),
spannableTitle.toString().indexOf("\n") + 1,
spannableTitle.toString().indexOf("\n") + 5,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTxtDate.setText(spannableTitle);
}
mTxtContent.setText(relevantTopicBean.getTitle());
mDividerTop.setVisibility(getItemViewType() == VIEW_TYPE_TOP || getItemViewType() == VIEW_TYPE_ONLY_ONE ? View.INVISIBLE : View.VISIBLE);
mDividerBottom.setVisibility(getItemViewType() == VIEW_TYPE_BOTTOM || getItemViewType() == VIEW_TYPE_ONLY_ONE ? View.INVISIBLE : View.VISIBLE);
}
代码示例来源:origin: guanpj/JReadHub
@Override
protected void convert(BaseViewHolder holder, RelevantTopicBean relevantTopicBean) {
LocalDate date = relevantTopicBean.getCreatedAt().toLocalDate();
int year = date.getYear();
int month = date.getMonthValue();
int day = date.getDayOfMonth();
if (year == OffsetDateTime.now().getYear()) {
holder.setText(R.id.txt_date, mContext.getString(R.string.month__day, month, day));
} else {
SpannableString spannableTitle = SpannableString.valueOf(mContext.getString(R.string.month__day__year, month, day, year));
spannableTitle.setSpan(new ForegroundColorSpan(ContextCompat.getColor(mContext, R.color.text_topic_detail_news_author)),
spannableTitle.toString().indexOf("\n") + 1,
spannableTitle.toString().indexOf("\n") + 5,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
holder.setText(R.id.txt_date, spannableTitle);
}
holder.setText(R.id.txt_topic_trace_content, relevantTopicBean.getTitle());
holder.setVisible(R.id.view_top_line, holder.getItemViewType() == VIEW_TYPE_TOP || holder.getItemViewType() == VIEW_TYPE_ONLY_ONE ? false : true);
holder.setVisible(R.id.view_bottom_line, holder.getItemViewType() == VIEW_TYPE_BOTTOM || holder.getItemViewType() == VIEW_TYPE_ONLY_ONE ? false : true);
}
}
代码示例来源:origin: guanpj/JReadHub
mTxtTopicTime.setText(mTopicBean.getFormattedPublishDate().toLocalDate().toString() + " " +
mTopicBean.getFormattedPublishDate().toLocalTime().toString().substring(0, 8));
} else {
代码示例来源:origin: ThreeTen/threetenbp
public Temporal adjustInto(Temporal temporal) {
return temporal
.with(EPOCH_DAY, toLocalDate().toEpochDay())
.with(NANO_OF_DAY, toLocalTime().toNanoOfDay())
.with(OFFSET_SECONDS, getOffset().getTotalSeconds());
代码示例来源:origin: org.threeten/threetenbp
public Temporal adjustInto(Temporal temporal) {
return temporal
.with(EPOCH_DAY, toLocalDate().toEpochDay())
.with(NANO_OF_DAY, toLocalTime().toNanoOfDay())
.with(OFFSET_SECONDS, getOffset().getTotalSeconds());
代码示例来源:origin: org.threeten/threetenbp
return (R) getOffset();
} else if (query == TemporalQueries.localDate()) {
return (R) toLocalDate();
} else if (query == TemporalQueries.localTime()) {
return (R) toLocalTime();
代码示例来源:origin: ThreeTen/threetenbp
return (R) getOffset();
} else if (query == TemporalQueries.localDate()) {
return (R) toLocalDate();
} else if (query == TemporalQueries.localTime()) {
return (R) toLocalTime();
内容来源于网络,如有侵权,请联系作者删除!