Example usage for org.joda.time YearMonthDay get

List of usage examples for org.joda.time YearMonthDay get

Introduction

In this page you can find the example usage for org.joda.time YearMonthDay get.

Prototype

public int get(DateTimeFieldType type) 

Source Link

Document

Get the value of one of the fields of a datetime.

Usage

From source file:net.sourceforge.fenixedu.util.date.SerializationTool.java

License:Open Source License

public static String yearMonthDaySerialize(final YearMonthDay yearMonthDay) {
    if (yearMonthDay != null) {
        final String dateString = String.format("%d-%02d-%02d", yearMonthDay.get(DateTimeFieldType.year()),
                yearMonthDay.get(DateTimeFieldType.monthOfYear()),
                yearMonthDay.get(DateTimeFieldType.dayOfMonth()));
        return dateString.length() != 10 ? null : dateString;
    }/*from ww w.j a v  a  2  s .c om*/
    return null;
}

From source file:org.fenixedu.academic.util.date.SerializationTool.java

License:Open Source License

public static String yearMonthDaySerialize(final YearMonthDay yearMonthDay) {
    if (yearMonthDay != null) {
        final String dateString = String.format("%04d-%02d-%02d", yearMonthDay.get(DateTimeFieldType.year()),
                yearMonthDay.get(DateTimeFieldType.monthOfYear()),
                yearMonthDay.get(DateTimeFieldType.dayOfMonth()));
        return dateString;
    }//from  ww  w  . ja  v  a2 s. c o  m
    return null;
}