BEGIN DATE PARSE METHODS 
Converts a date string to a date field array
@private
@param {String} sDate   Date string. Valid formats are mm/dd and mm/dd/yyyy.
@return    A date field array representing the string passed to the method
@type Array[](Number[])
347901
function(sDate) {
        var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER),
            rArray;

        if (aDate.length == 2) {
            rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
            rArray.type = Calendar.MONTH_DAY;
        } else {
            rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1] - this.Locale.YEAR_OFFSET, aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
            rArray.type = Calendar.DATE;
        }

        for (var i=0;i<rArray.length;i++) {
            rArray[i] = parseInt(rArray[i], 10);
        }
    
        return rArray;
    }
674044
function(date, inst) {
			var minDate = inst.get('minDate');
			var maxDate = inst.get('maxDate');
			date = (minDate && date.compareTo(minDate) === -1 ? minDate.newDate() : date);
			date = (maxDate && date.compareTo(maxDate) === +1 ? maxDate.newDate() : date);
			return date;
		}
695344
function formatDate(date, format)
  {
    let parsedDate = new Date(date)
    if (!isDate(parsedDate))
      throw new TypeError("A date or timestamp must be provided to {{formatDate}}")

    if (isString(format) && format in formats.date)
      format = formats.date[format]

    return getCachedDateTimeFormat(locale, format).format(parsedDate)
  }
734415
function parseDate(value) {
  let date = value;
  if (!value) {
    return new Date().getTime();
  }
  if (isObject(date)) {
    date = date.value || date;
  }
  // array
  if (isArray(date)) {
    date = new Date(...date).getTime();
  } else {
    // string number  null 、''、undefined
    date = new Date(date).getTime();
  }
  if (date) {
    return date;
  }
  console.warn('Invalid Date ', value);
  return new Date().getTime();
}
1099105
function parseISODate(str) {
  var date = '';

  if (str instanceof Date) return str;

  date += str.substr(0, 4) + '-';
  date += str.substr(4, 2) + '-';
  date += str.substr(6, 2);

  if (str.indexOf('T') > -1) {
    date += 'T' + str.substr(9, 2) + ':';
    date += str.substr(11, 2) + ':';
    date += str.substr(13, 2);
    date += str.substr(15);
  }

  return new Date(date);
}
655779
function formatDate(date) {
  let timestamp;
  if (date instanceof Date) {
    // Datadog expects seconds.
    timestamp = Math.round(date.getTime() / 1000);
  } else if (date instanceof Number) {
    // Make sure it is an integer, not a float.
    timestamp = Math.round(date);
  }
  return timestamp;
}
1240303
function (sDateString) {
			var iMillis = NativeDate_parse.apply(Date, arguments);
			if (sDateString && typeof sDateString === "string") {
				// if the year is gt/eq 2034 we need to increment the
				// date by one additional day since this is broken in
				// PhantomJS => this is a workaround for the upper BUG!
				var m = /^(\d{4})(?:-(\d+)?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/.exec(sDateString);
				if (m && parseInt(m[1]) >= 2034) {
					iMillis += 24 * 60 * 60 * 1000;
				}
			}
			return iMillis;
		}
890647
private String convertDate(Date date) {
        return android.text.format.DateFormat.format("yyyy-MM-dd", date).toString();
    }
223066
private static Date parseHTTPDateImpl(final String pDate) throws NumberFormatException  {
        if (pDate == null) {
            throw new IllegalArgumentException("date == null");
        }

        if (StringUtil.isEmpty(pDate)) {
            throw new NumberFormatException("Invalid HTTP date: \"" + pDate + "\"");
        }

        DateFormat format;

        if (pDate.indexOf('-') >= 0) {
            format = HTTP_RFC850_FORMAT;
            update50YearWindowIfNeeded();
        }
        else if (pDate.indexOf(',') < 0) {
            format = HTTP_ASCTIME_FORMAT;
            update50YearWindowIfNeeded();
        }
        else {
            format = HTTP_RFC1123_FORMAT;
            // NOTE: RFC1123 always uses 4-digit years
        }

        Date date;
        try {
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            synchronized (format) {
                date = format.parse(pDate);
            }
        }
        catch (ParseException e) {
            NumberFormatException nfe = new NumberFormatException("Invalid HTTP date: \"" + pDate + "\"");
            nfe.initCause(e);
            throw nfe;
        }

        if (date == null) {
            throw new NumberFormatException("Invalid HTTP date: \"" + pDate + "\"");
        }

        return date;
    }
528669
@Override
  public final String toDateTimeString(final Date pDate,
    final Map<String, Object> pAddParam) throws Exception {
    return this.dateTimeFormat.format(pDate);
  }
956376
function makeDateFromStringAndArray(string, formats) {
        var output,
            inputParts = string.match(parseMultipleFormatChunker) || [],
            formattedInputParts,
            scoreToBeat = 99,
            i,
            currentDate,
            currentScore;
        for (i = 0; i < formats.length; i++) {
            currentDate = makeDateFromStringAndFormat(string, formats[i]);
            formattedInputParts = formatMoment(new Moment(currentDate), formats[i]).match(parseMultipleFormatChunker) || [];
            currentScore = compareArrays(inputParts, formattedInputParts);
            if (currentScore < scoreToBeat) {
                scoreToBeat = currentScore;
                output = currentDate;
            }
        }
        return output;
    }
1075620
protected function parseRDate($rdate)
    {
        if (is_string($rdate)) {
            $rdate = explode(',', $rdate);
        }

        $this->dates = $rdate;
    }
326001
public static Date parseDate(String strdate) {

        /* Return in case the string date is not set */
        if (strdate == null || strdate.length() == 0) return null;

        Date result = null;
        strdate = strdate.trim();
        if (strdate.length() > 10) {

            /* Open: deal with +4:00 (no zero before hour) */
            if ((strdate.substring(strdate.length() - 5).indexOf("+") == 0 || strdate.substring(strdate.length() - 5).indexOf("-") == 0) && strdate.substring(strdate.length() - 5).indexOf(":") == 2) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                String sign = strdate.substring(strdate.length() - 5, strdate.length() - 4);
                strdate = strdate.substring(0, strdate.length() - 5) + sign + "0" + strdate.substring(strdate.length() - 4); //$NON-NLS-1$
            }

            String dateEnd = strdate.substring(strdate.length() - 6);

            /*
             * try to deal with -05:00 or +02:00 at end of date replace with -0500 or
             * +0200
             */
            if ((dateEnd.indexOf("-") == 0 || dateEnd.indexOf("+") == 0) && dateEnd.indexOf(":") == 3) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
                if (!"GMT".equals(strdate.substring(strdate.length() - 9, strdate.length() - 6))) { //$NON-NLS-1$
                    String oldDate = strdate;
                    String newEnd = dateEnd.substring(0, 3) + dateEnd.substring(4);
                    strdate = oldDate.substring(0, oldDate.length() - 6) + newEnd;
                }
            }
        }

        /* Try to parse the date */
        int i = 0;
        while (i < CUSTOM_DATE_FORMATS.length) {
            try {

                /*
                 * This Block needs to be synchronized, because the parse-Method in
                 * SimpleDateFormat is not Thread-Safe.
                 */
                synchronized (CUSTOM_DATE_FORMATS[i]) {
                    return CUSTOM_DATE_FORMATS[i].parse(strdate);
                }
            } catch (ParseException e) {
                i++;
            } catch (NumberFormatException e) {
                i++;
            }
        }
        return result;
    }
742754
public Date toDate(Object date) {

        Date d = null;
        if (null != date) {
            if (date instanceof Date) {
                d = (Date)date;
            } else if (date instanceof Long) {
                d = new Date(((Long)date).longValue());
            } else {
                try {
                    long l = Long.parseLong(date.toString());
                    d = new Date(l);
                } catch (Exception e) {
                    // do nothing, just let d remain null
                }
            }
        }
        return d;
    }
1127729
private Date toDate(final String pStringDate) {

        // weird manipulation to parse the date... remove ':' from the timezone
        // before: 2011-07-12T22:42:40.000+02:00
        // after: 2011-07-12T22:42:40.000+0200
        final StringBuilder _date = new StringBuilder();
        _date.append(pStringDate.substring(0, pStringDate.length() - 3));
        _date.append(pStringDate.substring(pStringDate.length() - 2));
        try {
            return new SimpleDateFormat(RFC_339_DATE_FORMAT).parse(_date.toString());
        } catch (final ParseException e) {
            throw new IllegalArgumentException(
                    "The given spreadsheet ListEntry usercrashdate field value is malformed", e);
        }
    }
903496
function makeDateFromStringAndFormat(config) {

        config._a = [];
        config._pf.empty = true;

        // This array is used to make a Date, either with `new Date` or `Date.UTC`
        var lang = getLangDefinition(config._l),
            string = '' + config._i,
            i, parsedInput, tokens, token, skipped,
            stringLength = string.length,
            totalParsedInputLength = 0;

        tokens = expandFormat(config._f, lang).match(formattingTokens) || [];

        for (i = 0; i < tokens.length; i++) {
            token = tokens[i];
            parsedInput = (getParseRegexForToken(token, config).exec(string) || [])[0];
            if (parsedInput) {
                skipped = string.substr(0, string.indexOf(parsedInput));
                if (skipped.length > 0) {
                    config._pf.unusedInput.push(skipped);
                }
                string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
                totalParsedInputLength += parsedInput.length;
            }
            // don't parse if it's not a known token
            if (formatTokenFunctions[token]) {
                if (parsedInput) {
                    config._pf.empty = false;
                }
                else {
                    config._pf.unusedTokens.push(token);
                }
                addTimeToArrayFromToken(token, parsedInput, config);
            }
            else if (config._strict && !parsedInput) {
                config._pf.unusedTokens.push(token);
            }
        }

        // add remaining unparsed input length to the string
        config._pf.charsLeftOver = stringLength - totalParsedInputLength;
        if (string.length > 0) {
            config._pf.unusedInput.push(string);
        }

        // handle am pm
        if (config._isPm && config._a[HOUR] < 12) {
            config._a[HOUR] += 12;
        }
        // if is 12 am, change hours to 0
        if (config._isPm === false && config._a[HOUR] === 12) {
            config._a[HOUR] = 0;
        }

        dateFromConfig(config);
        checkOverflow(config);
    }
1089417
public function date_before($sDate, $sParams)
    {
        //  If blank, then assume the date is not required
        if (empty($sDate)) {
            return true;
        }

        if (empty($sParams)) {
            return false;
        }

        $aParams = explode('.', $sParams);
        $sField  = !empty($aParams[0]) ? $aParams[0] : null;
        $sFormat = !empty($aParams[1]) ? $aParams[1] : 'Y-m-d';

        if (empty($sField)) {
            return false;
        }

        if (!array_key_exists('date_before', $this->_error_messages)) {
            $this->set_message('date_before', lang('fv_valid_date_before_field'));
        }

        //  If the other field is blank then bail out
        $oInput = Factory::service('Input');
        $sOther = $oInput->post($sField);
        if (empty($sOther)) {
            return false;
        }

        try {

            $oDate  = \DateTime::createFromFormat($sFormat, $sDate);
            $oOther = \DateTime::createFromFormat($sFormat, $sOther);

            if (empty($oDate) || $oOther) {
                return false;
            }

            $oDate->setTime(0, 0, 0);
            $oOther->setTime(0, 0, 0);

            return $oDate < $oOther;

        } catch (\Exception $e) {

            return false;
        }
    }