Example usage for org.joda.time.format DateTimeFormatter withPivotYear

List of usage examples for org.joda.time.format DateTimeFormatter withPivotYear

Introduction

In this page you can find the example usage for org.joda.time.format DateTimeFormatter withPivotYear.

Prototype

public DateTimeFormatter withPivotYear(int pivotYear) 

Source Link

Document

Returns a new formatter that will use the specified pivot year for two digit year parsing in preference to that stored in the parser.

Usage

From source file:org.wicketopia.joda.util.format.JodaFormatSupport.java

License:Apache License

@SuppressWarnings("unchecked")
public String convertToString(T object, Locale locale) {
    if (object == null) {
        return "";
    }//from   ww w  . j av a 2 s .  co m
    DateTime dt = translator.toDateTime((T) object);
    DateTimeFormatter format = formatProvider.getFormatter();
    format = format.withPivotYear(pivotYear).withLocale(locale);
    if (applyTimeZoneDifference) {
        TimeZone zone = getClientTimeZone();
        if (zone != null) {
            format = format.withZone(DateTimeZone.forTimeZone(zone));
        }
    }
    return format.print(dt);
}