public Date unmarshal ( String value ) { if ( value != null ) { if ( value . length ( ) >= lengthOfDateFmtYYYY_MM_DD ) { //Extract just the date from the string YYYY-MM-DD value = value . substring ( 0 , lengthOfDateFmtYYYY_MM_DD ) ; boolean isMatch = value . matches ( datePattern ) ; if ( isMatch ) { return DatatypeConverter . parseDate ( value ) . getTime ( ) ; } else { return DatatypeConverter . parseDate ( INVALIDDATE ) . getTime ( ) ; } } else { return DatatypeConverter . parseDate ( INVALIDDATE ) . getTime ( ) ; } } else { return null ; } }
Unmarshal a Date .