Example usage for org.joda.time.format ISOPeriodFormat alternateExtendedWithWeeks

List of usage examples for org.joda.time.format ISOPeriodFormat alternateExtendedWithWeeks

Introduction

In this page you can find the example usage for org.joda.time.format ISOPeriodFormat alternateExtendedWithWeeks.

Prototype

public static PeriodFormatter alternateExtendedWithWeeks() 

Source Link

Document

The alternate ISO format, Pyyyy-Www-ddThh:mm:ss, which excludes months.

Usage

From source file:colossal.pipe.BaseOptions.java

License:Apache License

private Period parseDuration() {
    PeriodFormatter[] toTry = { PeriodFormat.getDefault(), ISOPeriodFormat.standard(),
            ISOPeriodFormat.alternate(), ISOPeriodFormat.alternateExtended(),
            ISOPeriodFormat.alternateExtendedWithWeeks(), ISOPeriodFormat.alternateWithWeeks() };
    for (PeriodFormatter f : toTry) {
        try {//from  w ww. j  a  v  a  2  s.co m
            return f.parsePeriod(duration);
        } catch (IllegalArgumentException iae) {
            // skip to next
        }
    }
    throw new IllegalArgumentException("Can't parse: " + duration);
}