List of usage examples for org.apache.commons.lang.time FastDateFormat getInstance
public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale)
Gets a formatter instance using the specified pattern, time zone and locale.
From source file:net.sf.sprockets.database.sqlite.SQLite.java
/** * Get UTC date and time for the milliseconds since the epoch, in the format * {@code YYYY-MM-DD hh:mm:ss}./*from w w w.j av a 2 s. c o m*/ */ public static String datetime(long millis) { if (sFormat == null) { sFormat = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss", UTC_TIME_ZONE, US); } return sFormat.format(millis); }
From source file:com.liferay.portal.util.FastDateFormatFactoryImpl.java
public Format getSimpleDateFormat(String pattern, Locale locale, TimeZone timeZone) { ///////////// Start of modifications ///////////// locale = PlatformLocaleUtil.get().getAdminLocale(locale); ///////////// End of modifications ///////////// String key = getKey(pattern, locale, timeZone); Format format = _simpleDateFormats.get(key); if (format == null) { format = FastDateFormat.getInstance(pattern, timeZone, locale); _simpleDateFormats.put(key, format); }// ww w.j a va 2s . c om return format; }
From source file:com.hs.mail.imap.message.responder.AbstractImapResponder.java
protected String encodeDateTime(Date date) { FastDateFormat df = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", TimeZone.getTimeZone("GMT"), Locale.US);/*from ww w . j a v a 2s.c o m*/ return df.format(date); }
From source file:org.apache.james.imap.encode.EncoderUtils.java
/** * Encodes a date in IMAP <code>date-time</code> format. * /*from ww w.jav a 2 s . c o m*/ * @param date * <code>Date</code>, not null * @return encoded IMAP <code>date-time</code>, not null */ public static String encodeDateTime(Date date) { final FastDateFormat format = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", TimeZone.getTimeZone("GMT"), Locale.US); return format.format(date); }
From source file:org.apache.james.protocols.imap.utils.DecoderUtilsTest.java
private String formatAsImap(Date date, TimeZone zone) { assertNotNull(date);//from w w w .j a v a 2s .c o m FastDateFormat format = FastDateFormat.getInstance("dd-MMM-yyyy hh:mm:ss Z", zone, Locale.US); String out = format.format(date); if (out.charAt(0) == '0') { out = ' ' + out.substring(1, out.length()); } return out; }
From source file:org.codehaus.groovy.grails.web.converters.marshaller.json.DateMarshaller.java
/** * Default constructor.//w w w.j a v a2 s .c o m */ public DateMarshaller() { this(FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("GMT"), Locale.US)); }