src/org/ohmage/validator/SurveyResponseValidators.java
public static DateTime validateStartDate(final String startDate) 
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(startDate)) {
			return null;
		}

		try {
			return DateTimeUtils.getDateTimeFromString(startDate);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SERVER_INVALID_DATE, 
					"The date is not valid: " + startDate);
		}
	}
/**
	 * Validates that a date is a valid Date and returns it.
	 * 
	 * @param startDate The start date to be validated and decoded into a Date
	 * 					object.
	 * 
	 * @return Returns null if the start date was null or whitespace only.
	 * 		   Otherwise, it returns the decoded Date.
	 * 
	 * @throws ValidationException Thrown if the start date was not null, not
	 * 							   whitespace only, and not a valid date.
	 */
Validates that a date is a valid Date and returns it.

@param startDate The start date to be validated and decoded into a Date
object.

@return Returns null if the start date was null or whitespace only.
Otherwise, it returns the decoded Date.

@throws ValidationException Thrown if the start date was not null, not
whitespace only, and not a valid date.
Validates that a date is a valid Date and returns it . @param startDate The start date to be validated and decoded into a Date object . @return Returns null if the start date was null or whitespace only . Otherwise it returns the decoded Date . @throws ValidationException Thrown if the start date was not null not whitespace only and not a valid date .
public static DateTime validateStartDate(final String startDate) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(startDate)) {
			return null;
		}
		try {
			return DateTimeUtils.getDateTimeFromString(startDate);
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SERVER_INVALID_DATE, 
					"The date is not valid: " + startDate);
		}
	}
public static DateTime validateStartDate ( final String startDate ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( startDate ) ) { return null ; } try { return DateTimeUtils . getDateTimeFromString ( startDate ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . SERVER_INVALID_DATE , "The date is not valid: " + startDate ) ; } }
Validates that a date is a valid Date and returns it.
Validates that a date is a valid Date and returns it .