Java Code Examples for org.joda.time.format.ISODateTimeFormat#localDateParser()

The following examples show how to use org.joda.time.format.ISODateTimeFormat#localDateParser() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrimitiveColumnMetadata.java    From Bats with Apache License 2.0 6 votes vote down vote up
@Override
public DateTimeFormatter dateTimeFormatter() {
  String formatValue = format();
  try {
    switch (type) {
      case TIME:
        return formatValue == null
          ? ISODateTimeFormat.localTimeParser() : DateTimeFormat.forPattern(formatValue);
      case DATE:
        formatValue = format();
        return formatValue == null
          ? ISODateTimeFormat.localDateParser() : DateTimeFormat.forPattern(formatValue);
      case TIMESTAMP:
        formatValue = format();
        return formatValue == null
          ? ISODateTimeFormat.dateTimeNoMillis() : DateTimeFormat.forPattern(formatValue);
      default:
        throw new IllegalArgumentException("Column is not a date/time type: " + type.toString());
    }
  } catch (IllegalArgumentException e) {
    throw new IllegalArgumentException(String.format("The format \"%s\" is not valid for type %s",
        formatValue, type), e);
  }
}
 
Example 2
Source File: ParseLocalDateTest.java    From super-csv with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
	formatter = ISODateTimeFormat.localDateParser();
	processor1 = new ParseLocalDate();
	processor2 = new ParseLocalDate(formatter);
	processorChain1 = new ParseLocalDate(new IdentityTransform());
	processorChain2 = new ParseLocalDate(formatter, new IdentityTransform());
	processors = Arrays.asList(processor1, processor2, processorChain1,
			processorChain2);
}
 
Example 3
Source File: JodaLocalDateCodec.java    From actframework with Apache License 2.0 4 votes vote down vote up
@Override
protected DateTimeFormatter isoFormatter() {
    return ISODateTimeFormat.localDateParser();
}
 
Example 4
Source File: Arja_0049_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 5
Source File: Arja_0049_s.java    From coming with MIT License 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}
 
Example 6
Source File: Arja_0049_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 7
Source File: Arja_0049_t.java    From coming with MIT License 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}
 
Example 8
Source File: YearMonth.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a YearMonth from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public YearMonth(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 9
Source File: YearMonth.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a YearMonth from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public YearMonth(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}
 
Example 10
Source File: MonthDay.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 11
Source File: MonthDay.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}
 
Example 12
Source File: YearMonth.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a YearMonth from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public YearMonth(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 13
Source File: YearMonth.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a YearMonth from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public YearMonth(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}
 
Example 14
Source File: MonthDay.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The chronology used will be derived from the object, defaulting to ISO.
 *
 * @param instant  the date-time object, null means now
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant) {
    super(instant, null, ISODateTimeFormat.localDateParser());
}
 
Example 15
Source File: MonthDay.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a MonthDay from an Object that represents some form of time,
 * using the specified chronology.
 * <p>
 * The recognised object types are defined in
 * {@link org.joda.time.convert.ConverterManager ConverterManager} and
 * include ReadableInstant, String, Calendar and Date.
 * The String formats are described by {@link ISODateTimeFormat#localDateParser()}.
 * <p>
 * The constructor uses the time zone of the chronology specified.
 * Once the constructor is complete, all further calculations are performed
 * without reference to a time-zone (by switching to UTC).
 * The specified chronology overrides that of the object.
 *
 * @param instant  the date-time object, null means now
 * @param chronology  the chronology, null means ISO default
 * @throws IllegalArgumentException if the instant is invalid
 */
public MonthDay(Object instant, Chronology chronology) {
    super(instant, DateTimeUtils.getChronology(chronology), ISODateTimeFormat.localDateParser());
}