Package org.apache.commons.lang.time

Examples of org.apache.commons.lang.time.FastDateFormat


     * @param date
     *            <code>Date</code>, not null
     * @return encoded IMAP <code>date-time</code>, not null
     */
    public static String encodeDateTime(final Date date) {
        final FastDateFormat format = FastDateFormat.getInstance("dd-MMM-yyyy HH:mm:ss Z", TimeZone.getTimeZone("GMT"), Locale.US);
        final String result = format.format(date);
        return result;
    }
View Full Code Here


        assertEquals("Round trip", in, out);
    }

    private String formatAsImap(Date date, TimeZone zone) {
        assertNotNull(date);
        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;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.time.FastDateFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.