Example usage for org.joda.time ReadableDateTime getEra

List of usage examples for org.joda.time ReadableDateTime getEra

Introduction

In this page you can find the example usage for org.joda.time ReadableDateTime getEra.

Prototype

int getEra();

Source Link

Document

Get the era field value.

Usage

From source file:org.efaps.db.databases.PostgreSQLDatabase.java

License:Apache License

/**
 * {@inheritDoc}./*from ww w.ja  v a2 s. c o  m*/
 * <br/>
 * Postgres does not work with the year "ZERO" therefore the year
 * is translated like a Gregorian/Julian Calendar (ZERO = -1)
 */
@Override
public String getStr4DateTime(final ReadableDateTime _value) {
    String ret;
    if (_value.getEra() == 0) {
        ret = _value.toDateTime().minusYears(1).toString(ISODateTimeFormat.dateHourMinuteSecondFraction());
        ret = ret.substring(1) + " BC";
    } else {
        ret = _value.toDateTime().toString(ISODateTimeFormat.dateHourMinuteSecondFraction());
    }
    return ret;
}