Converts this object to a DateMidnight.

@param zone  the zone to get the DateMidnight in, null means default
@return the DateMidnight instance
337796
public DateMidnight toDateMidnight(DateTimeZone zone) {
        Chronology chrono = getChronology().withZone(zone);
        return new DateMidnight(getYear(), getMonthOfYear(), getDayOfMonth(), chrono);
    }
1192493
public Optional<ZonedDateTime> nextExecution(final ZonedDateTime date) {
        Preconditions.checkNotNull(date);
        try {
            ZonedDateTime nextMatch = nextClosestMatch(date);
            if (nextMatch.equals(date)) {
                nextMatch = nextClosestMatch(date.plusSeconds(1));
            }
            return Optional.of(nextMatch);
        } catch (final NoSuchValueException e) {
            return Optional.empty();
        }
    }
885181
public static final <T extends Calendar> Function<T, DateMidnight> calendarToDateMidnight(Chronology chronology) {
		return new CalendarToDateMidnight<T>(chronology);
	}
498472
@Override
    public ChronoZonedDateTime<D> atZone(ZoneId zone) {
        return ChronoZonedDateTimeImpl.ofBest(this, zone, null);
    }
372180
public static final <T extends Calendar> Function<T, DateTime> calendarToDateTime(DateTimeZone dateTimeZone) {
		return FnDateTime.calendarToDateTime(dateTimeZone);
	}
98625
public java.util.Date getDateWithDefaultZone() {
        LocalDate pickerDate = parentDatePicker.getDate();
        if (pickerDate == null) {
            return null;
        }
        Instant instant = pickerDate.atStartOfDay(ZoneId.systemDefault()).toInstant();
        // for backport: java.util.Date javaUtilDate = DateTimeUtils.toDate(instant);
        // for java.time: java.util.Date javaUtilDate = java.util.Date.from(instant);
        // This function was created to be compatible with both libraries.
        java.util.Date javaUtilDate = getJavaUtilDateFromInstant(instant);
        return javaUtilDate;
    }
436359
public java.util.Date getDateWithZone(ZoneId timezone) {
        LocalDate pickerDate = parentDatePicker.getDate();
        if (pickerDate == null || timezone == null) {
            return null;
        }
        Instant instant = pickerDate.atStartOfDay(timezone).toInstant();
        // for backport: java.util.Date javaUtilDate = DateTimeUtils.toDate(instant);
        // for java.time: java.util.Date javaUtilDate = java.util.Date.from(instant);
        // This function was created to be compatible with both libraries.
        java.util.Date javaUtilDate = getJavaUtilDateFromInstant(instant);
        return javaUtilDate;
    }
1155478
private static DateTimeZone getTimeZone(String id) {
    DateTimeZone zone;
    try {
      zone = DateTimeZone.forID(id);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException("TimeZone " + id + " not recognized");
    }
    return zone;
  }
1042937
public static CachedDateTimeZone forZone(DateTimeZone zone) {
        if (zone instanceof CachedDateTimeZone) {
            return (CachedDateTimeZone)zone;
        }
        return new CachedDateTimeZone(zone);
    }
1052538
public static TimeZone getTimeZone(String id) {
        if (id == null) {
            throw new NullPointerException("id == null");
        }

        // Special cases? These can clone an existing instance.
        if (id.length() == 3) {
            if (id.equals("GMT")) {
                return (TimeZone) GMTHolder.INSTANCE.clone();
            }
            if (id.equals("UTC")) {
                return (TimeZone) UTCHolder.INSTANCE.clone();
            }
        }

        // Native time zone?
        TimeZone zone = NativeTimeZone.get(id);

        // Custom time zone?
        if (zone == null && id.length() > 3 && id.startsWith("GMT")) {
            zone = getCustomTimeZone(id);
        }

        // We never return null; on failure we return the equivalent of "GMT".
        return (zone != null) ? zone : (TimeZone) GMTHolder.INSTANCE.clone();
    }
1051829
public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) {
	return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue);
    }
368572
public static ISOChronology getInstance(DateTimeZone zone) {
        if (zone == null) {
            zone = DateTimeZone.getDefault();
        }
        ISOChronology chrono = cCache.get(zone);
        if (chrono == null) {
            chrono = new ISOChronology(ZonedChronology.getInstance(INSTANCE_UTC, zone));
            ISOChronology oldChrono = cCache.putIfAbsent(zone, chrono);
            if (oldChrono != null) {
                chrono = oldChrono;
            }
        }
        return chrono;
    }
435208
public static TimeZone resolveTimeZone(Object timeZone) {
        if (timeZone instanceof String) {
            return TimeZone.getTimeZone((String) timeZone);
        }
        else if (timeZone instanceof TimeZone) {
            return (TimeZone) timeZone;
        }
        else {
            return TimeZone.getDefault();
        }
    }
30880
public static final <T extends Date> Function<T, DateTime> dateToDateTime(DateTimeZone dateTimeZone) {
		return FnDateTime.dateToDateTime(dateTimeZone);
	}
825192
public String resolveTimeZoneId(String zoneId) {
    String alias = _CalendarUtils.getTimeZoneAlias(zoneId);
    if (alias != null) {
      zoneId = alias;
    }
    alias = TimeZoneAliases.getAlias(zoneId);
    if (alias != null) {
      zoneId = alias;
    }
    return zoneId;
  }
946701
public DateTime toDateTime(DateTimeZone zone) {
        zone = DateTimeUtils.getZone(zone);
        if (getZone() == zone) {
            return this;
        }
        return super.toDateTime(zone);
    }
27072
public static LocalDateTime dateToLocalDateTime(Date date) {

        if (date == null) {
            return null;
        }
        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
    }