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

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

Introduction

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

Prototype

public static String format(final Calendar calendar, final String pattern, final TimeZone timeZone,
        final Locale locale) 

Source Link

Document

Formats a calendar into a specific pattern in a time zone and locale.

Usage

From source file:com.zaradai.bloodstone.text.TextUtils.java

@Override
public String formatDate(Date date, String format, TimeZone timeZone, Locale locale) {
    return DateFormatUtils.format(date, format, timeZone, locale);
}

From source file:com.gargoylesoftware.htmlunit.javascript.host.DateCustom.java

/**
 * Converts a date to a UTC string. Special version for IE
 * @param context the JavaScript context
 * @param thisObj the scriptable/*from   ww  w  .j a  va  2 s  .  c o  m*/
 * @param args the arguments passed into the method
 * @param function the function
 * @return converted string
 */
public static String toUTCString(final Context context, final Scriptable thisObj, final Object[] args,
        final Function function) {
    final Date date = new Date(getDateValue(thisObj));
    return DateFormatUtils.format(date, "EEE, d MMM yyyy HH:mm:ss z", UTC_TIME_ZONE, Locale.ENGLISH);
}