Initializes from the given date value
543385
def from_date(self, value: date) -> datetime:
        
        assert isinstance(value, date)

        #self.value = datetime.combine(value, time.min)
        self.value = datetime(value.year, value.month, value.day)
        return self.value
732444
def creation_date(self, value):
        
        self._creation_date = parse(value).date() if isinstance(value, type_check) else value
299229
def from_json(self, value):
        
        if value is None:
            return None

        if isinstance(value, six.binary_type):
            value = value.decode('utf-8')

        if isinstance(value, six.text_type):
            # Parser interprets empty string as now by default
            if value == "":
                return None
            try:
                value = dateutil.parser.parse(value)
            except (TypeError, ValueError):
                raise ValueError("Could not parse {} as a date".format(value))

        if not isinstance(value, datetime.datetime):
            raise TypeError(
                "Value should be loaded from a string, a datetime object or None, not {}".format(type(value))
            )

        if value.tzinfo is not None:  # pylint: disable=maybe-no-member
            return value.astimezone(pytz.utc)  # pylint: disable=maybe-no-member
        else:
            return value.replace(tzinfo=pytz.utc)
1338905
def set!(date)
      date = ::Time.parse date if date.is_a?(String)

      message = "DateTimeField##{__callee__} only accepts instances of DateTime or Time"
      raise ArgumentError, message unless [DateTime, ::Time].include?(date.class)

      date_time_string = date.strftime('%Y-%m-%dT%H:%M')
      element_call(:wait_for_writable) { execute_js(:setValue, @element, date_time_string) }
    end
62409
public static Value.Builder makeValue(Date date) {
    return Value.newBuilder().setTimestampValue(toTimestamp(date.getTime() * 1000L));
  }
283707
public static final Date parseFinishDateTime(String value)
   {
      Date result = parseDateTime(value);
      if (result != null)
      {
         result = DateHelper.addDays(result, -1);
      }
      return result;
   }
1042638
def set!(date)
      date = Date.parse date if date.is_a?(String)

      message = "DateField##{__callee__} only accepts instances of Date or Time"
      raise ArgumentError, message unless [Date, ::Time].include?(date.class)

      date_string = date.strftime('%Y-%m-%d')
      element_call(:wait_for_writable) { execute_js(:setValue, @element, date_string) }
    end
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());
    }
928388
function fromNow (val) {
    var v = arguments.length ? val : ttl;
    return new Date(Date.now() + ms(v));
  }
1108844
public static Date asDate(Object value) {
        if (value instanceof Date) {
            return (Date) value;
        } else if (value instanceof CharSequence) {
            String date = value.toString().trim();
            try {
                LocalDateTime time;
                if (date.endsWith("Z")) {
                    time = LocalDateTime.parse((CharSequence) value,
                                               DateTimeFormatter.ISO_INSTANT.withZone(Clock.systemUTC().getZone()));
                } else {
                    time = LocalDateTime.parse((CharSequence) value,
                                               DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(Clock.systemUTC().getZone()));
                }
                return new Date(time.atZone(Clock.systemUTC()
                                                 .getZone()).toInstant().toEpochMilli());
            } catch (RuntimeException e) {
                throw new ConfigException(e, "Unable to parse date: " + e.getMessage());
            }
        } else if (value instanceof Long) {
            // Longs are assumed to be java time (millis since epoch).
            return new Date((Long) value);
        } else if (value instanceof Integer) {
            // Integers are assumed to be unix time (seconds since epoch).
            return new Date(((Integer) value).longValue() * 1000L);
        } else {
            throw new IncompatibleValueException("Unable to convert " + value.getClass().getSimpleName() + " to a date");
        }
    }
1156659
function initialize(y, m, d) {
  var today = dateUtils.today();
  var thisDay = dateUtils.getDay(today);
  var thisMonth = dateUtils.getMonth(today);
  var thisYear = dateUtils.getYear(today);

  calendar.y = y || thisYear;
  calendar.m = m || thisMonth;
  calendar.d = d || thisDay;

  calendar.year = yearFactory.get(calendar.y);
}
1223333
private void initialize() {
        if (locale == null) {
            locale = ULocale.getDefault(Category.FORMAT);
        }
        if (formatData == null) {
            formatData = new DateFormatSymbols(locale);
        }
        if (calendar == null) {
            calendar = Calendar.getInstance(locale);
        }
        if (numberFormat == null) {
            NumberingSystem ns = NumberingSystem.getInstance(locale);
            if (ns.isAlgorithmic()) {
                numberFormat = NumberFormat.getInstance(locale);
            } else {
                String digitString = ns.getDescription();
                String nsName = ns.getName();
                // Use a NumberFormat optimized for date formatting
                numberFormat = new DateNumberFormat(locale, digitString, nsName);
            }
        }
        // Note: deferring calendar calculation until when we really need it.
        // Instead, we just record time of construction for backward compatibility.
        defaultCenturyBase = System.currentTimeMillis();

        setLocale(calendar.getLocale(ULocale.VALID_LOCALE ), calendar.getLocale(ULocale.ACTUAL_LOCALE));
        initLocalZeroPaddingNumberFormat();

        if (override != null) {
           initNumberFormatters(locale);
        }

        parsePattern();
    }
210199
public void setStartdate(Object objStartDate) throws PageException {
	if (StringUtil.isEmpty(objStartDate)) return;
	this.startdate = new DateImpl(DateCaster.toDateAdvanced(objStartDate, pageContext.getTimeZone()));
    }
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)
1178222
def init_from_str(self, entries):
        
        self.lines = self.parser.parse_text(entries)

        for line in self.lines:
            if isinstance(line, DateLine):
                current_date = line.date
                self[current_date] = self.default_factory(self, line.date)
            elif isinstance(line, Entry):
                if len(self[current_date]) > 0:
                    line.previous_entry = self[current_date][-1]
                    self[current_date][-1].next_entry = line

                self[current_date].append(line)
673583
public static Date getDate(
    Object   value)
  {
    if (value == null)
    {
        return null;
    }

    if (value instanceof Date)
    {
        return ((Date) value);
    }

    return parseISODate(value.toString());
  }
1306694
function coerceDate(value) {
    if (value instanceof Date) {
        return value;
    }

    let timestamp = Date.parse(value);

    if (!isNaN(timestamp)) {
        return new Date(timestamp);
    }

    return value;
}