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

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

Introduction

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

Prototype

FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT

To view the source code for org.apache.commons.lang.time DateFormatUtils ISO_DATETIME_TIME_ZONE_FORMAT.

Click Source Link

Document

ISO8601 formatter for date-time with time zone.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Date today = new Date();

    String timestamp = DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(today);
    System.out.println("timestamp = " + timestamp);

}

From source file:MainClass.java

public static void main(String[] pArgs) throws Exception {
    Date now = new Date();
    System.out.println("now: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(now));
    System.out.println("UTC Time: "
            + DateFormatUtils.formatUTC(now, DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern()));

}

From source file:MainClass.java

public static void main(String[] pArgs) throws Exception {
    Date now = new Date();
    System.out.println("now: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(now));
    Iterator iter = DateUtils.iterator(now, DateUtils.RANGE_WEEK_SUNDAY);
    while (iter.hasNext()) {
        Calendar cal = (Calendar) iter.next();
        Date cur = cal.getTime();
        System.out.println("iterate: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(cur));
    }/*from  w  w  w .j a va 2 s . c om*/
}

From source file:MainClass.java

public static void main(String[] pArgs) throws Exception {
    Date now = new Date();
    System.out.println(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(now));

}

From source file:MainClass.java

public static void main(String[] pArgs) throws Exception {
    Date now = new Date();
    Date truncYear = DateUtils.truncate(now, Calendar.YEAR);
    Date truncMonth = DateUtils.truncate(now, Calendar.MONTH);
    System.out.println("now: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(now));
    System.out.println("truncYear: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(truncYear));
    System.out.println("truncMonth: " + DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(truncMonth));
}

From source file:com.smartitengineering.cms.ws.common.utils.Utils.java

public static String getFormattedDate(Date date) {
    return DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date);
}

From source file:com.smartitengineering.cms.ws.common.utils.Utils.java

public static Date parseStringAsDate(String dateString) throws ParseException {
    return DateUtils.parseDate(dateString,
            new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
}

From source file:com.smartitengineering.cms.api.impl.content.DateTimeFieldValueImpl.java

static MutableDateTimeFieldValue valueOf(String value) throws ParseException {
    DateTimeFieldValueImpl fieldValue = new DateTimeFieldValueImpl();
    fieldValue.setValue(DateUtils.parseDate(value,
            new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() }));
    return fieldValue;
}

From source file:com.smartitengineering.cms.spi.impl.hbase.Utils.java

public static byte[] toBytes(final Date date) {
    if (date == null) {
        return new byte[0];
    }/*from w ww  . ja v a2s .c  o  m*/
    try {
        return StringUtils.getBytesUtf8(DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.format(date));
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}

From source file:com.smartitengineering.cms.spi.impl.hbase.Utils.java

public static Date toDate(final byte[] dateBytes) {
    try {/*from  w w  w .  j  a  va 2s  . c  om*/
        String dateString = StringUtils.newStringUtf8(dateBytes);
        return DateUtils.parseDate(dateString,
                new String[] { DateFormatUtils.ISO_DATETIME_TIME_ZONE_FORMAT.getPattern() });
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}