Added logic to handle null value for DateTime types which was causing NullPointerException.