Example usage for org.joda.time.format ISODateTimeFormat dateTimeNoMillis

List of usage examples for org.joda.time.format ISODateTimeFormat dateTimeNoMillis

Introduction

In this page you can find the example usage for org.joda.time.format ISODateTimeFormat dateTimeNoMillis.

Prototype

public static DateTimeFormatter dateTimeNoMillis() 

Source Link

Document

Returns a formatter that combines a full date and time without millis, separated by a 'T' (yyyy-MM-dd'T'HH:mm:ssZZ).

Usage

From source file:io.apiman.manager.api.rest.impl.OrganizationResourceImpl.java

License:Apache License

/**
 * Parses a query param representing a date into an actual date object.
 * @param dateStr// w  w w .j  a  v  a  2  s.c  om
 * @param defaultDate
 * @param floor
 */
private static DateTime parseDate(String dateStr, DateTime defaultDate, boolean floor) {
    if ("now".equals(dateStr)) { //$NON-NLS-1$
        return DateTime.now();
    }
    if (dateStr.length() == 10) {
        DateTime parsed = ISODateTimeFormat.date().withZoneUTC().parseDateTime(dateStr);
        // If what we want is the floor, then just return it.  But if we want the
        // ceiling of the date, then we need to set the right params.
        if (!floor) {
            parsed = parsed.plusDays(1).minusMillis(1);
        }
        return parsed;
    }
    if (dateStr.length() == 20) {
        return ISODateTimeFormat.dateTimeNoMillis().withZoneUTC().parseDateTime(dateStr);
    }
    if (dateStr.length() == 24) {
        return ISODateTimeFormat.dateTime().withZoneUTC().parseDateTime(dateStr);
    }
    return defaultDate;
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("creation_time")
public void setCreationTimeIso8601(String dateStr) {
    if (null != dateStr) {
        creationTime = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }/*w  w w . jav  a2  s.  co  m*/
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("start_time")
public void setStartTimeIso8601(String dateStr) {
    if (null != dateStr) {
        startTime = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }/* www  .ja va 2s  . co  m*/
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("end_time")
public void setEndTimeIso8601(String dateStr) {
    if (null != dateStr) {
        endTime = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }//w  w w  . j a v a  2  s  .c om
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("pause_time")
public void setPauseTimeIso8601(String dateStr) {
    if (null != dateStr) {
        pauseTime = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }/*from   w  ww. j av  a 2s  .com*/
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("current_time")
public void setCurrentTimeIso8601(String dateStr) {
    if (null != dateStr) {
        currentTime = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }/*from   w  w  w.j  ava 2  s  .  c  o  m*/
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@JsonProperty("estimated_time_of_arrival")
public void setEstimatedTimeOfArrivalIso8601(String dateStr) {
    if (null != dateStr) {
        estimatedTimeOfArrival = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }/*from ww  w .  ja v a  2s. c o m*/
}

From source file:io.cassandrareaper.resources.view.RepairRunStatus.java

License:Apache License

@Nullable
public static String dateTimeToIso8601(@Nullable DateTime dateTime) {
    return null != dateTime ? ISODateTimeFormat.dateTimeNoMillis().print(dateTime) : null;
}

From source file:io.cassandrareaper.resources.view.RepairScheduleStatus.java

License:Apache License

@JsonProperty("next_activation")
public void setNextActivationIso8601(String dateStr) {
    if (null != dateStr) {
        nextActivation = ISODateTimeFormat.dateTimeNoMillis().parseDateTime(dateStr);
    }//from  w  w  w .  j  a  va  2s . c om
}

From source file:io.smalldata.ohmageomh.surveys.domain.ISOW3CDateTimeFormat.java

License:Apache License

/**
 * Returns a formatter that combines a full date, two digit hour of the
 * day, two digit minute of the hour, two digit second of the minute
 * and a time zone.//  w w  w.jav a  2 s .  c  o m
 * 
 * @return A formatter for the date, hour, minute, second, and time
 *          zone.
 */
public static DateTimeFormatter dateHourMinuteSecondZone() {
    if (yearMonthDayHourMinuteSecondZone == null) {
        yearMonthDayHourMinuteSecondZone = ISODateTimeFormat.dateTimeNoMillis().withOffsetParsed();
    }
    return yearMonthDayHourMinuteSecondZone;
}