Parses the date to milliseconds and rounds up to the nearest second.

@param date the date to parse
@param defaultValue the default value if the date is null
@return the rounded milliseconds
436977
private long parseDate(Date date, long defaultValue) // d666295
    {
        if (date == null)
        {
            return defaultValue;
        }

        long value = date.getTime();

        if (value > 0)
        {
            // Round up to the nearest second.
            long remainder = value % 1000;
            if (remainder != 0)
            {
                // Protect against overflow.
                long newValue = value - remainder + 1000;
                value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE;
            }
        }

        return value;
    }
158000
public static long secsSinceEpoch(DateValue date) {
        long result = fixedFromGregorian(date) *
                SECS_PER_DAY;
        if (date instanceof TimeValue) {
            TimeValue time = (TimeValue) date;
            result +=
                    time.second() +
                            60 * (time.minute() +
                                    60 * time.hour());
        }
        return result;
    }
926240
public void setDateWithDefaultZone(java.util.Date javaUtilDate) {
        if (javaUtilDate == null) {
            parentDatePicker.setDate(null);
            return;
        }
        Instant instant = Instant.ofEpochMilli(javaUtilDate.getTime());
        ZonedDateTime zonedDateTime = instant.atZone(ZoneId.systemDefault());
        LocalDate localDate = zonedDateTime.toLocalDate();
        parentDatePicker.setDate(localDate);
    }
923997
public static String formatUnixTimestampInMills(Date date) {
        if (date == null)
            return null;
        BigDecimal dateValue = BigDecimal.valueOf(date.getTime());
        return dateValue.toPlainString();
    }
57917
function(inst, date, defaultDate) {
		var offsetNumeric = function(offset) {
				var date = new Date();
				date.setDate(date.getDate() + offset);
				return date;
			},
			offsetString = function(offset) {
				try {
					return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
						offset, $.datepicker._getFormatConfig(inst));
				}
				catch (e) {
					// Ignore
				}

				var date = (offset.toLowerCase().match(/^c/) ?
					$.datepicker._getDate(inst) : null) || new Date(),
					year = date.getFullYear(),
					month = date.getMonth(),
					day = date.getDate(),
					pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
					matches = pattern.exec(offset);

				while (matches) {
					switch (matches[2] || "d") {
						case "d" : case "D" :
							day += parseInt(matches[1],10); break;
						case "w" : case "W" :
							day += parseInt(matches[1],10) * 7; break;
						case "m" : case "M" :
							month += parseInt(matches[1],10);
							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
							break;
						case "y": case "Y" :
							year += parseInt(matches[1],10);
							day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
							break;
					}
					matches = pattern.exec(offset);
				}
				return new Date(year, month, day);
			},
			newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
				(typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));

		newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
		if (newDate) {
			newDate.setHours(0);
			newDate.setMinutes(0);
			newDate.setSeconds(0);
			newDate.setMilliseconds(0);
		}
		return this._daylightSavingAdjust(newDate);
	}
411696
public static String formatServiceSpecificDate(Date date) {
        if (date == null)
            return null;
        BigDecimal dateValue = BigDecimal.valueOf(date.getTime());
        return dateValue.scaleByPowerOfTen(0 - AWS_DATE_MILLI_SECOND_PRECISION)
                .toPlainString();
    }
713980
public static Date toDate(Object value, Date defaultValue) {
		return convert(Date.class, value, defaultValue);
	}
1212954
public static double toDouble(Object value, double defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Double) {
			return (double) value;
		}
		if (value instanceof Date) {
			final Date date = (Date) value;
			return date.getTime();
		}
		return Double.parseDouble(value.toString());
	}
1176675
public static Date beginOfMinute(@NotNull final Date date) {
		return DateUtils.truncate(date, Calendar.MINUTE);
	}
603360
@Override
    public NumberValue round(MathContext mathContext) {
        if (this.number instanceof BigDecimal) {
            return new DefaultNumberValue(((BigDecimal) this.number).round(mathContext));
        }
        return new DefaultNumberValue(new BigDecimal(this.number.toString()).round(mathContext));
    }
853488
public static DateTime offsetMillisecond(Date date, int offset) {
		return offset(date, DateField.MILLISECOND, offset);
	}
1257095
def parse_dates(d, default='today'):
    

    if default == 'today':
        default = datetime.datetime.today()

    if d is None:
        return default

    elif isinstance(d, _parsed_date_types):
        return d

    elif is_number(d):
        # Treat as milliseconds since 1970
        d = d if isinstance(d, float) else float(d)
        return datetime.datetime.utcfromtimestamp(d)

    elif not isinstance(d, STRING_TYPES):
        if hasattr(d, '__iter__'):
            return [parse_dates(s, default) for s in d]
        else:
            return default

    elif len(d) == 0:
        # Behaves like dateutil.parser < version 2.5
        return default

    else:
        try:
            return parser.parse(d)
        except (AttributeError, ValueError):
            return default
479613
public Date getDate( String key, Date defaultValue )
        throws MissingResourceException
    {
        try
        {
            return getDate( key );
        }
        catch( MissingResourceException mre )
        {
            return defaultValue;
        }
    }
766653
public double computeValue(double srcValue)
    {
        double fldTimeField = 0;
        if (m_fldTimeField != null)
            fldTimeField = m_fldTimeField.getValue();
        else
            fldTimeField = 0;
        double dateThisDate = ((DateTimeField)this.getOwner()).getValue();
        double newDateTime = dateThisDate + fldTimeField * DBConstants.KMS_IN_A_DAY;  // Rounded number of days
        return newDateTime;    // Difference between this date and target
    }
1351580
public static String formatDateTime(Date date) {
		if (null == date) {
			return null;
		}
		return DatePattern.NORM_DATETIME_FORMAT.format(date);
	}
454684
public com.google.type.DateOrBuilder getDateValueOrBuilder() {
    if (typeCase_ == 7) {
      return (com.google.type.Date) type_;
    }
    return com.google.type.Date.getDefaultInstance();
  }
570099
public String convertDateToString(final Date date) {
        if (date == null) {
            return null;
        }
        return dateFormat.get().format(date);
    }