Package org.sf.bee.commons.util

Examples of org.sf.bee.commons.util.DecodedDate


   
    @Test
    public void testCookie() {
        System.out.println("cookie");
       
        DecodedDate dd = new DecodedDate();
        dd.set(1970, 1, 1);
        dd.setSecond(1);
        String sdate = dd.toString(DecodedDate.PATTERNS[4], Locale.ENGLISH);
        //assertEquals(sdate, "Thu, 01-Jan-1970 00:00:01");
        String text = "reg_fb_gate=deleted; expires=\"Thu, 01-Jan-1970 00;00:01\"; path=/; domain=.foo.com;";
       
        WebCookie cookie = new WebCookie(text);
        assertTrue(cookie.getName().equals("reg_fb_gate"));
View Full Code Here


    }

    public void setExpires(Object value) {
        try {
            if (null != value) {
                final DecodedDate dt = DecodedDate.parse(value.toString());
                this._expiryDate = dt.getDateTime();
            }
        } catch (Throwable t) {
            this._expiryDate = DateUtils.now();
        }
    }
View Full Code Here

     * Date Utility
     */
    public String formatDate(final Date date) {
        String result = null;
        try {
            final DecodedDate dd = new DecodedDate();
            if (null != date) {
                dd.setDateTime(date);
                result = dd.toString(DEFAULT_LOCALE);
            } else {
                throw new Exception("Date cannot be null.");
            }
        } catch (Exception ex) {
            result = "Error: [" + ex.getMessage() + "]";
View Full Code Here

    }

    public String formatDate(final Date date, final String dateFormat) {
        String result = null;
        try {
            final DecodedDate dd = new DecodedDate();
            if (null != date) {
                dd.setDateTime(date);
                result = dd.toString(dateFormat);
            } else {
                throw new Exception("Date cannot be null.");
            }
        } catch (Exception ex) {
            result = "Error: [" + ex.getMessage() + "]";
View Full Code Here

    public String formatDate(final String inputDate,
            final String inputDateFormat, final String outputDateFormat) {
        String result = null;
        try {
            final DecodedDate dd = new DecodedDate();
            if (null != inputDate && null != inputDateFormat) {
                dd.setDateTime(inputDate, inputDateFormat);
                result = dd.toString(outputDateFormat);
            } else {
                throw new Exception("Date and Format cannot be null.");
            }
        } catch (Exception ex) {
            result = "Error: [" + ex.getMessage() + "]";
View Full Code Here

    }

    private String formatMonth(final int month, final Locale locale) {
        String result = null;
        try {
            final DecodedDate dd = new DecodedDate();
            if (month > 0) {
                dd.setMonth(month);
                result = dd.toString("MMMM", locale);
            } else {
                throw new Exception("Month cannot be zero (allowed 1-12).");
            }
        } catch (Exception ex) {
            result = "Error: [" + ex.getMessage() + "]";
View Full Code Here

TOP

Related Classes of org.sf.bee.commons.util.DecodedDate

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.