Example usage for org.apache.commons.lang.time DateFormatUtils format

List of usage examples for org.apache.commons.lang.time DateFormatUtils format

Introduction

In this page you can find the example usage for org.apache.commons.lang.time DateFormatUtils format.

Prototype

public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) 

Source Link

Document

Formats a date/time into a specific pattern in a time zone and locale.

Usage

From source file:org.alfresco.repo.webdav.WebDAV.java

/**
 * Formats the given date for use in the HTTP header
 * /*from   w  ww. ja v a 2 s  .  co  m*/
 * @param date Date
 * @return String
 */
public static String formatHeaderDate(Date date) {
    // HTTP header date/time format
    // NOTE: According to RFC2616 dates should always be in English and in
    //        the GMT timezone see http://rfc.net/rfc2616.html#p20 for details
    return DateFormatUtils.format(date, HEADER_IF_DATE_FORMAT, TimeZone.getTimeZone("GMT"), Locale.ENGLISH);
}

From source file:org.alfresco.repo.webdav.WebDAV.java

/**
 * Formats the given date for use in the HTTP header
 * //from   ww  w .j av a  2  s  . com
 * @param ldate long
 * @return String
 */
public static String formatHeaderDate(long ldate) {
    // HTTP header date/time format
    // NOTE: According to RFC2616 dates should always be in English and in
    //        the GMT timezone see http://rfc.net/rfc2616.html#p20 for details
    return DateFormatUtils.format(ldate, HEADER_IF_DATE_FORMAT, TimeZone.getTimeZone("GMT"), Locale.ENGLISH);
}