Formats a date in M/D/YYYY format.

 The +date+ can be either a string already in the correct format, or a Date/Time object.
 If +date+ is blank or nil, then nil will be returned.
432186
def fmt_date(date)
      return nil if date.blank?
      return nil unless (date.is_a?(String) || date.is_a?(Date) || date.is_a?(Time))
      unless date.is_a?(String)
        date = date.to_s(:date4)
      end
      m,d,y = date.split('/')
      "#{m.to_i}/#{d.to_i}/#{y.to_i}"
    end
408631
def QA_util_date_str2int(date):
    
    # return int(str(date)[0:4] + str(date)[5:7] + str(date)[8:10])
    if isinstance(date, str):
        return int(str().join(date.split('-')))
    elif isinstance(date, int):
        return date
219135
def format_date_argument(date_element):
    
    if not isinstance(date_element, (datetime.datetime, datetime.date)):
        # TODO:
        if "T" in date_element:
            _date = datetime.datetime.strptime(date_element, "%Y-%m-%dT%H:%M:%S")
        else:
            _date = datetime.datetime.strptime(date_element, "%Y-%m-%d").date()
    else:
        _date = date_element
    return _date.isoformat()
849851
function getDate (dateString) {
  var date = new Date(dateString);

  if (Object.prototype.toString.call(date) === '[object Date]' && !isNaN(date.getTime())) {
    return date;
  }

  //try to fix invalid date
  date = fixInvalidDate(dateString);

  //if date still isn't valid there's not more we can do..
  if (!isNaN(date.getTime())) {
    return date;
  }
}
839815
public static String convertDateToDateString(Date date) {
		if (date == null) {
			return null;
		} else {
			// DateFormat df = new SimpleDateFormat("yyyy-MM-dd'Z'");
			DateTimeFormatter df = FORMATTER_DATE_Z;
			return df.print(date.getTime());
		}
	}
1362048
def format_date(ctx, text):
    
    dt = conversions.to_datetime(text, ctx)
    return dt.astimezone(ctx.timezone).strftime(ctx.get_date_format(True))
996647
function formatTime(date) {
	var n = date.getFullYear(); 
	var y = date.getMonth() + 1;
	var r = date.getDate(); 
	var mytime = date.toLocaleTimeString(); 
	var mytimes = n+ "-" + y + "-" + r + " " + mytime;
  return mytimes;
}
93327
def _get_date_type(date):
        
        if isinstance(date, str):
            return 'str'

        if isinstance(date, datetime.date):
            return 'date'

        if isinstance(date, int):
            return 'int'

        raise ValueError('Unexpected type {0!s}'.format(date.__class__))
1160728
public static String formatDateAsYMD(Date date) {
        String retString = "";
        if (date != null) {
            retString = JinxUtils.ymdFormatter.format(date);
        }
        return retString;
    }
1065781
function stringDate(value) {
    //  Empty string
    if (!value.length)
        return false;
    //  MM.DD.YYYY. - format
    //  valid separators -> . , / - \s
    if (value.search(/[.,/\\-]/g) > -1) {
        var date = value.split(/[.,/-\s]/g);
        var month = +date[0];
        var day = +date[1];
        var isValid = void 0;
        for (var _i = 0, months_2 = months_1.months; _i < months_2.length; _i++) {
            var _month = months_2[_i];
            (_month.ord >= month && _month.days >= day) ? isValid = true : isValid = false;
        }
        return isValid ? !isNaN(Date.parse(value)) : false;
    }
    //  YYYY-MM-DDTTT:HH:MM.SSSZ - format
    return !isNaN(Date.parse(value));
}
813019
def select_simple_date(date_input, value, format = nil)
      value = value.strftime format unless format.nil?

      date_input.set "#{value}\e"
    end
928768
public static String format(Date date, DateFormat format) {
		if (null == format || null == date) {
			return null;
		}
		return format.format(date);
	}
1331883
function (str, format) {
  if (arguments.length) {
    var date = toStringDate(str, format)
    return baseExports.isDate(date) ? getDateTime(date) : date
  }
  return now()
}
907836
def date(objet):
        
        if objet:
            return "{}/{}/{}".format(objet.day, objet.month, objet.year)
        return ""
438418
function formatDate(date) {
  date = new Date(date);
  var monthNames = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'June',
    'July',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec'
  ];
  return (
    monthNames[date.getMonth()] +
    ' ' +
    date.getDate() +
    ', ' +
    date.getFullYear()
  );
}
1000839
public static boolean isDate(String date) {
        if (isEmpty(date)) return defaultEmptyOK;
        String month;
        String day;
        String year;

        int dateSlash1 = date.indexOf("/");
        int dateSlash2 = date.lastIndexOf("/");

        if (dateSlash1 <= 0 || dateSlash1 == dateSlash2) return false;
        month = date.substring(0, dateSlash1);
        day = date.substring(dateSlash1 + 1, dateSlash2);
        year = date.substring(dateSlash2 + 1);

        return isDate(year, month, day);
    }
920987
def date(self):
        
        if self._date:
            return self._date
        return datetime.datetime.now().strftime('%Y-%m-%d')