/** * Deserialize date from text. Date values are expected to match W3C XML Schema standard format * as CCYY-MM-DD, with optional leading minus sign if necessary. This method follows standard * JiBX deserializer usage requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * @return converted date, or <code>null</code> if passed <code>null</code> input * @throws IllegalArgumentException on parse error */ public static Date deserializeDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDate(text)); } }
/** * Deserialize SQL date from text. Date values are expected to match W3C XML Schema standard * format as CCYY-MM-DD, with optional leading minus sign if necessary. This method follows * standard JiBX deserializer usage requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * @return converted date, or <code>null</code> if passed <code>null</code> input * @throws IllegalArgumentException on parse error */ public static java.sql.Date deserializeSqlDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { // convert value, assuming maximum daylight time change of 2 hours long time = parseDate(text); time += (TimeZone.getDefault().getRawOffset() + (MSPERHOUR * 2)); return new java.sql.Date(time); } }
/** * Parse general dateTime value from text. Date values are expected to be in W3C XML Schema * standard format as CCYY-MM-DDThh:mm:ss.fff, with optional leading sign and trailing time * zone. * * @param text text to be parsed * @return converted date as millisecond value * @throws IllegalArgumentException on parse error */ public static long parseDateTime(String text) throws IllegalArgumentException { // split text to convert portions separately int split = text.indexOf('T'); if (split < 0) { throw new IllegalArgumentException("Missing 'T' separator in dateTime"); } return parseDate(text.substring(0, split)) + parseTime(text, split + 1, text.length()); }
/** * Deserialize date from text. Date values are expected to match W3C XML * Schema standard format as CCYY-MM-DD, with optional leading minus sign * if necessary. This method follows standard JiBX deserializer usage * requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static Date deserializeDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDate(text)); } }
/** * Deserialize date from text. Date values are expected to match W3C XML * Schema standard format as CCYY-MM-DD, with optional leading minus sign * if necessary. This method follows standard JiBX deserializer usage * requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static Date deserializeDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { return new Date(parseDate(text)); } }
/** * Deserialize SQL date from text. Date values are expected to match W3C * XML Schema standard format as CCYY-MM-DD, with optional leading minus * sign if necessary. This method follows standard JiBX deserializer usage * requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static java.sql.Date deserializeSqlDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { // convert value, assuming maximum daylight time change of 2 hours long time = parseDate(text); time += (TimeZone.getDefault().getRawOffset() + (MSPERHOUR * 2)); return new java.sql.Date(time); } }
/** * Deserialize SQL date from text. Date values are expected to match W3C * XML Schema standard format as CCYY-MM-DD, with optional leading minus * sign if necessary. This method follows standard JiBX deserializer usage * requirements by accepting a <code>null</code> input. * * @param text text to be parsed (may be <code>null</code>) * * @return converted date, or <code>null</code> if passed <code>null</code> * input * * @throws IllegalArgumentException on parse error */ public static java.sql.Date deserializeSqlDate(String text) throws IllegalArgumentException { if (text == null) { return null; } else { // convert value, assuming maximum daylight time change of 2 hours long time = parseDate(text); time += (TimeZone.getDefault().getRawOffset() + (MSPERHOUR * 2)); return new java.sql.Date(time); } }
/** * Parse general dateTime value from text. Date values are expected to be * in W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss.fff, with * optional leading sign and trailing time zone. * * @param text text to be parsed * * @return converted date as millisecond value * * @throws IllegalArgumentException on parse error */ public static long parseDateTime(String text) throws IllegalArgumentException { // split text to convert portions separately int split = text.indexOf('T'); if (split < 0) { throw new IllegalArgumentException( "Missing 'T' separator in dateTime"); } return parseDate(text.substring(0, split)) + parseTime(text, split + 1, text.length()); }
/** * Parse general dateTime value from text. Date values are expected to be * in W3C XML Schema standard format as CCYY-MM-DDThh:mm:ss.fff, with * optional leading sign and trailing time zone. * * @param text text to be parsed * * @return converted date as millisecond value * * @throws IllegalArgumentException on parse error */ public static long parseDateTime(String text) throws IllegalArgumentException { // split text to convert portions separately int split = text.indexOf('T'); if (split < 0) { throw new IllegalArgumentException( "Missing 'T' separator in dateTime"); } return parseDate(text.substring(0, split)) + parseTime(text, split + 1, text.length()); }