/** * Convert a string value represented a date into a Nullable<DateTime>. * * @throws InvalidFormatException * Throws if the date format isnot valid. */ private Nullable <DateTime> SetDateValue(String s) { if (s == null || s.Equals("")) { return(new Nullable <DateTime>()); } else { SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'"); DateTime d = (DateTime)df.ParseObject(s, 0); if (d == null) { throw new InvalidFormatException("Date not well formated"); } return(new Nullable <DateTime>(d)); } }