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

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

Introduction

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

Prototype

FastDateFormat ISO_DATE_TIME_ZONE_FORMAT

To view the source code for org.apache.commons.lang3.time DateFormatUtils ISO_DATE_TIME_ZONE_FORMAT.

Click Source Link

Document

ISO 8601-like formatter for date with time zone.

Usage

From source file:dev.maisentito.suca.commands.SeenCommandHandler.java

@Override
public void handleCommand(MessageEvent event, String[] args) throws Throwable {
    synchronized (this) {
        if (mSeenUsers.containsKey(args[0].toLowerCase())) {
            SeenData seenData = mSeenUsers.get(args[0].toLowerCase());
            String formatted;/*w  w w.  j a  v a2  s  .  c om*/

            if (DateUtils.isSameDay(seenData.time, new Date())) {
                formatted = DateFormatUtils.ISO_TIME_NO_T_TIME_ZONE_FORMAT.format(seenData.time);
            } else {
                formatted = DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.format(seenData.time);
            }

            event.respond(String.format("seen: %s <%s> %s", formatted, seenData.nick, seenData.message));
        } else {
            event.respond("seen: user " + args[0] + " not seen");
        }
    }
}

From source file:eu.trentorise.opendata.commons.TodUtils.java

/**
 * @deprecated experimental, try to avoid using it for now
 * @since 1.1//from   w ww  .  jav a2  s  .  c o  m
 * @throws TodParseException
 */
// todo this parser is horrible
public static Date parseIso8061(String s) {

    try {
        return DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    try {
        return DateFormatUtils.ISO_DATETIME_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    try {
        return DateFormatUtils.ISO_DATE_TIME_ZONE_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    try {
        return DateFormatUtils.ISO_DATE_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    try {
        return ISO_YEAR_MONTH_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    try {
        return ISO_YEAR_FORMAT.parse(s);
    } catch (ParseException ex) {
    }

    // todo week dates, ordinal dates

    throw new TodParseException("Couldn't parse date as ISO8061. Unparseable date was:" + s);
}