Example usage for org.joda.time Period years

List of usage examples for org.joda.time Period years

Introduction

In this page you can find the example usage for org.joda.time Period years.

Prototype

public static Period years(int years) 

Source Link

Document

Create a period with a specified number of years.

Usage

From source file:org.openvpms.archetype.rules.util.DateUnits.java

License:Open Source License

/**
 * Converts a value in the units to a {@code Period}.
 *
 * @param value the value//from   w  w  w . j av  a 2  s .c  om
 * @return a new period
 */
public Period toPeriod(int value) {
    switch (this) {
    case MINUTES:
        return Period.minutes(value);
    case HOURS:
        return Period.hours(value);
    case DAYS:
        return Period.days(value);
    case WEEKS:
        return Period.weeks(value);
    case MONTHS:
        return Period.months(value);
    default:
        return Period.years(value);
    }
}