Simple date strip method. Checks if the <astr_datestr>
  contains <astr_sep>. If so, strips these from the string
  and returns result.

  The actual stripping entails falling through two layers
  of exception handling... so it is something of a hack.
171560
def str_dateStrip(astr_datestr, astr_sep='/'):
  
  try:
    index = astr_datestr.index(astr_sep)
  except:
    return astr_datestr.encode('ascii')

  try:
    tm = time.strptime(astr_datestr, '%d/%M/%Y')
  except:
    try:
      tm = time.strptime(astr_datestr, '%d/%M/%y')
    except:
      error_exit('str_dateStrip', 'parsing date string',
                 'no conversion was possible', 1)
  tstr = time.strftime("%d%M%Y", tm)
  return tstr.encode('ascii')
1159327
private static void convertDateString(String str) {
        try {
            Date date = Utils.dateFromString(str);
            display("Date to millis: " + date.getTime());
        } catch (Exception e) {
        }
    }
634345
def deserialize_rfc(attr):
        
        if isinstance(attr, ET.Element):
            attr = attr.text
        try:
            date_obj = datetime.datetime.strptime(
                attr, "%a, %d %b %Y %H:%M:%S %Z")
            if not date_obj.tzinfo:
                date_obj = date_obj.replace(tzinfo=TZ_UTC)
        except ValueError as err:
            msg = "Cannot deserialize to rfc datetime object."
            raise_with_traceback(DeserializationError, msg, err)
        else:
            return date_obj
258537
def parse(cls, datestr):
        
        m = DATE_RE.match(datestr)
        if m is not None:
            day = None if m.group(2) is None else int(m.group(2))
            return cls(m.group(4), m.group(3), day, m.group(1))
1163535
def _evalDateStr(self, datetimeString, sourceTime):
        
        s = datetimeString.strip()
        sourceTime = self._evalDT(datetimeString, sourceTime)

        # Given string is in the format  "May 23rd, 2005"
        debug and log.debug('checking for MMM DD YYYY')
        return self.parseDateText(s, sourceTime)
786514
function makeDateStr(date, sep) {
	if (sep === undefined) sep = true;

	var year = date.getUTCFullYear().toString(),
		month = padNum(date.getUTCMonth()+1),
		day = padNum(date.getUTCDate()),
		hours = padNum(date.getUTCHours()),
		minutes = padNum(date.getUTCMinutes()),
		seconds = padNum(date.getUTCSeconds());

	if (sep) {
		return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
	} else {
		return year + month + day + hours + minutes + seconds;
	}
}
1187074
function (dateStr) {
            var calendar = /**@type {KISSY.Date.Gregorian}
             @ignore*/
                new GregorianCalendar(this.timezoneOffset, this.locale), i, j, tmp = {}, obeyCount = false, dateStrLen = dateStr.length, errorIndex = -1, startIndex = 0, oldStartIndex = 0, pattern = this.pattern, len = pattern.length;
            loopPattern: {
                for (i = 0; errorIndex < 0 && i < len; i++) {
                    var comp = pattern[i], text, textLen;
                    oldStartIndex = startIndex;
                    if (text = comp.text) {
                        textLen = text.length;
                        if (textLen + startIndex > dateStrLen) {
                            errorIndex = startIndex;
                        } else {
                            for (j = 0; j < textLen; j++) {
                                if (text.charAt(j) !== dateStr.charAt(j + startIndex)) {
                                    errorIndex = startIndex;
                                    break loopPattern;
                                }
                            }
                            startIndex += textLen;
                        }
                    } else if ('field' in comp) {
                        obeyCount = false;
                        var nextComp = pattern[i + 1];
                        if (nextComp) {
                            if ('field' in nextComp) {
                                obeyCount = true;
                            } else {
                                var c = nextComp.text.charAt(0);
                                if (c >= '0' && c <= '9') {
                                    obeyCount = true;
                                }
                            }
                        }
                        startIndex = parseField(calendar, dateStr, startIndex, comp.field, comp.count, this.locale, obeyCount, tmp);
                        if (startIndex === oldStartIndex) {
                            errorIndex = startIndex;
                        }
                    }
                }
            }
            if (errorIndex >= 0) {
                logger.error('error when parsing date');
                logger.error(dateStr);
                logger.error(dateStr.substring(0, errorIndex) + '^');
                return undefined;
            }
            return calendar;
        }
812202
public static  boolean isDate(String str) {  
    	try {
    		DateUtils.parseDate(str);
    		return true;
		} catch (Exception e) {
			return false;
		}
    }
819371
def extract_date(cls, date_str):
        
        if not date_str:
            raise DateTimeFormatterException('date_str must a valid string {}.'.format(date_str))

        try:
            return cls._extract_timestamp(date_str, cls.DATE_FORMAT)
        except (TypeError, ValueError):
            raise DateTimeFormatterException('Invalid date string {}.'.format(date_str))
1329315
def in_date(objet, pattern):
        
        if objet:
            pattern = re.sub(" ", '', pattern)
            objet_str = abstractRender.date(objet)
            return bool(re.search(pattern, objet_str))
        return False
906718
public static String formatDateStr(String dateStr, String... patterns) {
        String pattern = TIMESTAMP_PATTERN;
        if (patterns != null && patterns.length > 0
                && StringUtils.isNotBlank(patterns[0])) {
            pattern = patterns[0];
        }
        return DateFormatUtils.format(parseDate(dateStr), pattern);
    }
1358234
function isValidDate(str) {
  // str must have passed the ISO8601 check
  // this check is meant to catch invalid dates
  // like 2009-02-31
  // first check for ordinal dates
  var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);

  if (ordinalMatch) {
    var oYear = Number(ordinalMatch[1]);
    var oDay = Number(ordinalMatch[2]); // if is leap year

    if (oYear % 4 === 0 && oYear % 100 !== 0) return oDay <= 366;
    return oDay <= 365;
  }

  var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number);
  var year = match[1];
  var month = match[2];
  var day = match[3];
  var monthString = month ? "0".concat(month).slice(-2) : month;
  var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare

  var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01'));
  if (isNaN(d.getUTCFullYear())) return false;

  if (month && day) {
    return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
  }

  return true;
}
694254
def _stripStrList(self, raw_str, stop_strs):
        '''
        
        '''
        if type(stop_strs) == list:
            for word in stop_strs:
                raw_str = self._stripStr(raw_str, word)
            return raw_str
        else:
            raise Exception('stop_words must be list!')
1340023
public String stripAndTrim(String str) {
		MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
		params.putSingle("string", str);
		return getEntity(invokeGet("utils/nosymbols", params), String.class);
	}
948330
def parse_date(date_str):
    """"""
    if not date_str:
        return None

    try:
        date = ciso8601.parse_datetime(date_str)
        if not date:
            date = arrow.get(date_str).datetime
    except TypeError:
        date = arrow.get(date_str[0]).datetime
    return date
255837
def parse_date(self, value):
        
        if value is None:
            raise Exception("Unable to parse date from %r" % value)
        elif isinstance(value, string_types):
            return self.str2date(value)
        elif isinstance(value, int):
            return date.fromordinal(value)
        elif isinstance(value, datetime):
            return value.date()
        elif isinstance(value, date):
            return value
        else:
            raise Exception("Unable to parse date from %r" % value)
730077
@Override
  public final Date fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    return this.dateTimeSecNoTzFormatIso8601.parse(pStrVal);
  }