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

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

Introduction

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

Prototype

public static PeriodFormatter alternateWithWeeks() 

Source Link

Document

The alternate ISO format, PyyyyWwwddThhmmss, 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 {/* ww w  . j  av  a  2s .co  m*/
            return f.parsePeriod(duration);
        } catch (IllegalArgumentException iae) {
            // skip to next
        }
    }
    throw new IllegalArgumentException("Can't parse: " + duration);
}