Returns the date for {@code value}. Returns null if the value couldn't be
parsed.
6567
public static Date parse(String value) {
        try {
            return STANDARD_DATE_FORMAT.get().parse(value);
        } catch (ParseException ignore) {
        }
        for (String formatString : BROWSER_COMPATIBLE_DATE_FORMATS) {
            try {
                return new SimpleDateFormat(formatString, Locale.US).parse(value);
            } catch (ParseException ignore) {
            }
        }
        return null;
    }
751645
public String marshal(Date value) {
		
		if(value == null){
			return null;
		}
		
		return formatter.print(new DateTime(value));

	}
386643
public static Date parse(String value) {
    if (value.length() == 0) {
      return null;
    }

    ParsePosition position = new ParsePosition(0);
    Date result = STANDARD_DATE_FORMAT.get().parse(value, position);
    if (position.getIndex() == value.length()) {
      // STANDARD_DATE_FORMAT must match exactly; all text must be consumed, e.g. no ignored
      // non-standard trailing "+01:00". Those cases are covered below.
      return result;
    }
    synchronized (BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS) {
      for (int i = 0, count = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS.length; i < count; i++) {
        DateFormat format = BROWSER_COMPATIBLE_DATE_FORMATS[i];
        if (format == null) {
          format = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US);
          // Set the timezone to use when interpreting formats that don't have a timezone. GMT is
          // specified by RFC 7231.
          format.setTimeZone(UTC);
          BROWSER_COMPATIBLE_DATE_FORMATS[i] = format;
        }
        position.setIndex(0);
        result = format.parse(value, position);
        if (position.getIndex() != 0) {
          // Something was parsed. It's possible the entire string was not consumed but we ignore
          // that. If any of the BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS ended in "'GMT'" we'd have
          // to also check that position.getIndex() == value.length() otherwise parsing might have
          // terminated early, ignoring things like "+01:00". Leaving this as != 0 means that any
          // trailing junk is ignored.
          return result;
        }
      }
    }
    return null;
  }
168850
private String formatDate(Date value)
   {
      return (value == null ? null : m_formats.getDateFormat().format(value));
   }
927321
@Override
    public Object getValue() {
        Date d = Calendar.getInstance().getTime();
        try {
            d = DEFAULT_DATE_FORMAT.parse(((JTextField) editor).getText());
        } catch (ParseException ex) {
            Logger.getLogger(CalendarStringPropertyEditor.class.getName()).log(Level.SEVERE, null, ex);
        }
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        return c;
    }
305895
public static final Duration parseDuration(String value)
   {
      return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);
   }
17380
public static Calendar read(String value) {
		Date date=DateUtils.read(value);
		
		Calendar calendar=Calendar.getInstance();
		calendar.setTime(date);
		
		return calendar;
	}
482595
public static Object convertValue(final Object value, final Class<?> convertType) {
        if (null == value) {
            return convertNullValue(convertType);
        } 
        if (value.getClass() == convertType) {
            return value;
        }
        if (value instanceof Number) {
            return convertNumberValue(value, convertType);
        }
        if (value instanceof Date) {
            return convertDateValue(value, convertType);
        }
        if (String.class.equals(convertType)) {
            return value.toString();
        } else {
            return value;
        }
    }
433774
public static String getValueLabel(final Object value) {
        if (value == null) {
            return NULL_LABEL;
        }

        if (value instanceof HasLabelAdvice) {
            final String suggestedLabel = ((HasLabelAdvice) value).getSuggestedLabel();
            if (!Strings.isNullOrEmpty(suggestedLabel)) {
                return suggestedLabel;
            }
        }

        // format decimals
        if (value instanceof Double || value instanceof Float || value instanceof BigDecimal) {
            final NumberFormat format = NumberFormat.getNumberInstance();
            final String result = format.format((Number) value);
            logger.debug("Formatted decimal {} to: {}", value, result);
            return result;
        }

        // format dates
        if (value instanceof Date) {
            final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
            final String result = format.format((Date) value);
            logger.debug("Formatted date {} to: {}", value, result);
            return result;
        }

        return getLabel(value.toString());
    }
1108091
public static Date decodeDate(String value) throws ParseException {
        String javaValue = value.substring(0, value.length() - 3) + value.substring(value.length() - 2);
        SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
        return dateFormatter.parse(javaValue);
    }
972454
private static boolean isDate(String value) {
    try {
      new SimpleDateFormat("yyyyMMddHHmmss").parse(value);
      return true;
    } catch (ParseException e) {
      return false;
    }
  }
1115796
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;
		}
	}
650137
@CheckForNull
  public static Date parseDateQuietly(@Nullable String s) {
    Date date = null;
    if (s != null) {
      try {
        date = parseDate(s);
      } catch (RuntimeException e) {
        // ignore
      }

    }
    return date;
  }
534010
function (value) {
    var date = new Date(value)
    assertErr(!isNaN(date.getTime()), TypeError, 'Field error: value is an invalid Date')
    return date
  }
383397
public static Date parseBasicTime(String value) throws ParseException
   {
      Date result = null;

      if (value.length() > 0)
      {
         if (!value.equals("0"))
         {
            value = "000000" + value;
            value = value.substring(value.length() - 6);
            result = TIME_FORMAT.get().parse(value);
         }
      }

      return result;
   }
1352367
private Date readOptionalDate(JSONValue val) {

        JSONString str = null == val ? null : val.isString();
        if (str != null) {
            try {
                return new Date(Long.parseLong(str.stringValue()));
            } catch (@SuppressWarnings("unused") NumberFormatException e) {
                // do nothing - return the default value
            }
        }
        return null;
    }
932158
public static java.sql.Date toDate(Object value) throws ParseException {
        if (value == null) {
            return null;
        }
        if (value instanceof java.sql.Date) {
            return (java.sql.Date) value;
        }
        if (value instanceof String) {
            if ("".equals((String) value)) {
                return null;
            }
            return new java.sql.Date(IN_DATE_FORMAT.parse((String) value).getTime());
        }

        return new java.sql.Date(IN_DATE_FORMAT.parse(value.toString()).getTime());
    }