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

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

Introduction

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

Prototype

FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT

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

Click Source Link

Document

ISO 8601-like formatter for time 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;//from ww w .j a  v  a 2  s .co  m

            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");
        }
    }
}