List of usage examples for org.joda.time.format ISODateTimeFormat localDateParser
public static DateTimeFormatter localDateParser()
From source file:com.allogy.json.jackson.joda.ISOLocalDateDeserializer.java
License:Apache License
public ISOLocalDateDeserializer() { localDateFormatter = ISODateTimeFormat.localDateParser(); }
From source file:com.tsp.converter.StringToDate.java
public LocalDate convert(String s) { return ISODateTimeFormat.localDateParser().parseLocalDate(s); }
From source file:org.aksw.simba.bengal.triple2nl.converter.LiteralConverter.java
License:Apache License
private String convertDateLiteral(LiteralLabel lit) { RDFDatatype dt = lit.getDatatype();/* www .j a v a 2s. c om*/ String s = lit.getLexicalForm(); try { Object value = lit.getValue(); if (value instanceof XSDDateTime) { Calendar calendar = ((XSDDateTime) value).asCalendar(); if (dt.equals(XSDDatatype.XSDgMonth)) { s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL); } else if (dt.equals(XSDDatatype.XSDgMonthDay)) { s = calendar.get(Calendar.DAY_OF_MONTH) + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL); } else if (dt.equals(XSDDatatype.XSDgYearMonth)) { s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " " + calendar.get(Calendar.YEAR); } else if (dt.equals(XSDDatatype.XSDgYear)) { s = "" + calendar.get(Calendar.YEAR); } else { s = calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, ENGLISH_LOCAL) + " " + calendar.get(Calendar.DAY_OF_MONTH) + ", " + calendar.get(Calendar.YEAR); // dateFormat.format(calendar.getTime()); } } } catch (DatatypeFormatException | IllegalDateTimeFieldException e) { logger.error("Conversion of date literal " + lit + " failed. Reason: " + e.getMessage()); // fallback // DateTime time = ISODateTimeFormat.dateTime DateTime time; try { time = ISODateTimeFormat.dateTimeParser().parseDateTime(lit.getLexicalForm()); s = time.toString("MMMM dd, yyyy"); } catch (Exception e1) { try { time = ISODateTimeFormat.localDateParser().parseDateTime(lit.getLexicalForm()); s = time.toString("MMMM dd, yyyy"); } catch (Exception e2) { e2.printStackTrace(); time = ISODateTimeFormat.dateParser().parseDateTime(lit.getLexicalForm()); s = time.toString("MMMM dd, yyyy"); } } } return s; }
From source file:org.fuin.objects4j.common.LocalDateAdapter.java
License:Open Source License
@Override public final LocalDate unmarshal(final String str) { if (str == null) { return null; }/* ww w . j a va 2 s.co m*/ return LocalDate.parse(str, ISODateTimeFormat.localDateParser()); }
From source file:org.fuin.objects4j.common.LocalDateAdapter.java
License:Open Source License
@Override public final LocalDate convertToEntityAttribute(final String str) { if (str == null) { return null; }/* www. j a v a 2s . c o m*/ return LocalDate.parse(str, ISODateTimeFormat.localDateParser()); }