src/org/ohmage/util/StringUtils.java
public static Date decodeDate(String date) {
		if(isEmptyOrWhitespaceOnly(date)) {
			return null;
		}
		
		try {
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_AMERICAN_DATE);
			simpleDateFormat.setLenient(false);
			
			return simpleDateFormat.parse(date);
		}
		catch(ParseException americanException) {
			try {
				SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_ISO_8601_DATE);
				simpleDateFormat.setLenient(false);
				
				return simpleDateFormat.parse(date);
			}
			catch(ParseException iso8601Exception) {
				return null;
			}
		}
	}
/**
	 * Decodes a String representing a date and returns a resulting Date
	 * object. The date may follow any of these formats:
	 * <ul>
	 *   <li>{@value #FORMAT_AMERICAN_DATE}</li>
	 *   <li>{@value #FORMAT_ISO_8601_DATE}</li>
	 * </ul>
	 * 
	 * @param date The date as a String that is to be decoded.
	 * 
	 * @return Returns null if the date is null, whitespace only, or doesn't
	 * 		   follow one of the given format patterns. Otherwise, a new Date
	 * 		   object that represents the date is returned.
	 */
Decodes a String representing a date and returns a resulting Date
object. The date may follow any of these formats:

 #FORMAT_AMERICAN_DATE
 #FORMAT_ISO_8601_DATE


@param date The date as a String that is to be decoded.

@return Returns null if the date is null, whitespace only, or doesn't
follow one of the given format patterns. Otherwise, a new Date
object that represents the date is returned.
Decodes a String representing a date and returns a resulting Date object . The date may follow any of these formats : #FORMAT_AMERICAN_DATE #FORMAT_ISO_8601_DATE @param date The date as a String that is to be decoded . @return Returns null if the date is null whitespace only or doesn ' t follow one of the given format patterns . Otherwise a new Date object that represents the date is returned .
public static Date decodeDate(String date) {
		if(isEmptyOrWhitespaceOnly(date)) {
			return null;
		}
		try {
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_AMERICAN_DATE);
			simpleDateFormat.setLenient(false);
			return simpleDateFormat.parse(date);
		}
		catch(ParseException americanException) {
			try {
				SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_ISO_8601_DATE);
				simpleDateFormat.setLenient(false);
				return simpleDateFormat.parse(date);
			}
			catch(ParseException iso8601Exception) {
				return null;
			}
		}
	}
public static Date decodeDate ( String date ) { if ( isEmptyOrWhitespaceOnly ( date ) ) { return null ; } try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( FORMAT_AMERICAN_DATE ) ; simpleDateFormat . setLenient ( false ) ; return simpleDateFormat . parse ( date ) ; } catch ( ParseException americanException ) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat ( FORMAT_ISO_8601_DATE ) ; simpleDateFormat . setLenient ( false ) ; return simpleDateFormat . parse ( date ) ; } catch ( ParseException iso8601Exception ) { return null ; } } }
Decodes a String representing a date and returns a resulting Date
 object.
Decodes a String representing a date and returns a resulting Date object .