Java Code Examples for org.apache.commons.lang3.time.DateFormatUtils#formatUTC()

The following examples show how to use org.apache.commons.lang3.time.DateFormatUtils#formatUTC() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MailTemplateHelpers.java    From Singularity with Apache License 2.0 5 votes vote down vote up
public String humanizeTimestamp(long timestamp) {
  if (taskDatePattern.isPresent() && timeZone.isPresent()) {
    return DateFormatUtils.format(timestamp, taskDatePattern.get(), timeZone.get());
  } else if (taskDatePattern.isPresent()) {
    return DateFormatUtils.formatUTC(timestamp, taskDatePattern.get());
  } else if (timeZone.isPresent()) {
    return DateFormatUtils.format(timestamp, DEFAULT_TIMESTAMP_FORMAT, timeZone.get());
  } else {
    return DateFormatUtils.format(timestamp, DEFAULT_TIMESTAMP_FORMAT);
  }
}
 
Example 2
Source File: AbstractMetricsAccessor.java    From apiman with Apache License 2.0 4 votes vote down vote up
/**
 * @param date
 */
protected static String formatDate(Calendar date) {
    return DateFormatUtils.formatUTC(date.getTimeInMillis(), "yyyy-MM-dd'T'HH:mm:ss'Z'"); //$NON-NLS-1$
}
 
Example 3
Source File: AbstractMetricsAccessor.java    From apiman with Apache License 2.0 4 votes vote down vote up
/**
 * @param date
 */
protected static String formatDateWithMillis(Calendar date) {
    return DateFormatUtils.formatUTC(date.getTimeInMillis(), "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); //$NON-NLS-1$
}
 
Example 4
Source File: TimeUtils.java    From frpMgr with MIT License 2 votes vote down vote up
/**
 * 使用日期对象构造时间
 * @param date
 */
public TimeUtils(Date date){
	this(DateFormatUtils.formatUTC(date, "HH:mm:ss"));
}
 
Example 5
Source File: WebDAV.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Formats the given date so that it conforms with the WebDAV creation date/time format
 * 
 * @param date The date to format
 * @return The formatted date string
 */
public static String formatCreationDate(Date date)
{
    return DateFormatUtils.formatUTC(date, CREATION_DATE_FORMAT);
}
 
Example 6
Source File: WebDAV.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Formats the given date so that it conforms with the WebDAV creation date/time format
 * 
 * @param ldate long
 * @return The formatted date string
 */
public static String formatCreationDate(long ldate)
{
    return DateFormatUtils.formatUTC(ldate, CREATION_DATE_FORMAT);
}
 
Example 7
Source File: TimeUtils.java    From Shop-for-JavaWeb with MIT License 2 votes vote down vote up
/**
 * 使用日期对象构造时间
 * @param date
 */
public TimeUtils(Date date){
	this(DateFormatUtils.formatUTC(date, "HH:mm:ss"));
}