/** * Construct an <code>xsd:dateTime</code> literal. * * Beware that although this is constructed from a Java {@link Date} * parameter, the datatype of the created literal is not * <code>xsd:date</code>. * * @param date the date value of the literal */ public LiteralImpl(Date date) { this(XSD.getLexicalForm(date), XSD.DATE_TIME_URI); }
public String getLexicalForm() { String dateTime = XSD.getLexicalFormOfDate(date); return dateTime; }
static SPDateImpl newInstance(String lexicalForm) { try { Date date = XSD.parseLexicalForm(lexicalForm); return new SPDateImpl(date); } catch (Exception ex) { throw new IllegalArgumentException("Cannot parse date: " + lexicalForm); } }
static SPDateTimeImpl newInstance(String lexicalForm) { try { Date date = XSD.parseLexicalForm(lexicalForm); return new SPDateTimeImpl(date); } catch (Exception ex) { throw new IllegalArgumentException("Cannot parse date: " + lexicalForm, ex); } }
/** * Returns the lexical form of the XSD dateTime value according to * "3.2.7.2 Canonical representation" of * http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/ * with the following exceptions: * - Timezones are not supported * - Dates before 1 CE (i.e. 1 AD) are handled according to ISO 8601:2000 * Second Edition: * "0000" is the lexical representation of 1 BCE * "-0001" is the lexical representation of 2 BCE * @return the lexical form of the XSD dateTime value */ public String getLexicalForm() { return XSD.getLexicalForm(date); }