本文整理汇总了Java中hirondelle.date4j.DateTime.format方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.format方法的具体用法?Java DateTime.format怎么用?Java DateTime.format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hirondelle.date4j.DateTime
的用法示例。
在下文中一共展示了DateTime.format方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertDateTimeToDate
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static Date convertDateTimeToDate(DateTime dateTime) {
String dateString = dateTime.format("YYYY-MM-DD");
try {
return getDateFromString(dateString, null);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
示例2: getDateString
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private String getDateString(final DateTime dateTime) {
return dateTime.format("YYYYMMDD");
}
示例3: convertToStringList
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static String convertToStringList(DateTime dateTime) {
return dateTime.format("YYYY-MM-DD");
}
示例4: getWeekName
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private static String getWeekName(Week week) {
DateTime weekStart = DateTimeUtil.stringToDateTime(week.getStart());
return "week-beginning-on-" + weekStart.format("YYYY-MM-DD");
}
示例5: dateTimeToString
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Formats a {@link DateTime} to a String.
*
* @param dateTime
* the input (may not be null)
* @return the String which corresponds to the given input
*/
public static String dateTimeToString(DateTime dateTime) {
return dateTime.format("YYYY-MM-DD hh:mm:ss.ffff");
}
示例6: dateTimeToDateString
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Formats a {@link DateTime} to a String which contains the date only (omitting the time part).
*
* @param dateTime
* the input (may not be null)
* @return the String which corresponds to the given input
*/
public static String dateTimeToDateString(DateTime dateTime) {
return dateTime.format("YYYY-MM-DD");
}
示例7: dateTimeToHourMinuteString
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Formats a {@link DateTime} to a String which contains the hour and minute only (omitting the date and the
* seconds).
*
* @param dateTime
* the input (may not be null)
* @return the String which corresponds to the given input
*/
public static String dateTimeToHourMinuteString(DateTime dateTime) {
// if the format is changed here, change it also in the method getCompleteDayAsHourMinuteString()
return dateTime.format("hh:mm");
}