本文整理汇总了Java中org.threeten.bp.format.DateTimeFormatter.ofLocalizedTime方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeFormatter.ofLocalizedTime方法的具体用法?Java DateTimeFormatter.ofLocalizedTime怎么用?Java DateTimeFormatter.ofLocalizedTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.format.DateTimeFormatter
的用法示例。
在下文中一共展示了DateTimeFormatter.ofLocalizedTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatDateTime
import org.threeten.bp.format.DateTimeFormatter; //导入方法依赖的package包/类
private String formatDateTime(Context context, LocalDateTime dateTime) {
String dayPattern = context.getString(R.string.schedule_pager_day_pattern);
DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern(dayPattern, Locale.getDefault());
DateTimeFormatter timeFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
String formatted = context.getString(R.string.schedule_browse_sessions_title_pattern,
dateTime.format(dayFormatter),
dateTime.format(timeFormatter));
return Strings.capitalizeFirstLetter(formatted);
}
示例2: bindTalkInfo
import org.threeten.bp.format.DateTimeFormatter; //导入方法依赖的package包/类
private void bindTalkInfo(Session session) {
DateTimeFormatter timeFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
String day = session.getFromTime().format(DateTimeFormatter.ofPattern(getString(R.string.session_details_talk_info_date_pattern)));
String fromTime = session.getFromTime().format(timeFormatter);
String toTime = session.getToTime().format(timeFormatter);
String room = session.getRoom();
talkInfo.setText(Strings.capitalizeFirstLetter(getString(R.string.session_details_talk_info, day, fromTime, toTime, room)));
}
示例3: formatTime
import org.threeten.bp.format.DateTimeFormatter; //导入方法依赖的package包/类
private String formatTime(LocalDateTime time) {
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT);
return time.format(formatter);
}