Returns a <code>ZonedDateTime</code> from the given epoch value.

@param epoch
value in milliseconds
@return a <code>ZonedDateTime</code> or null if the date is not valid
160484
private static ZonedDateTime toZonedDateTimeUtc(final long epochValue, final EpochUnits units) {
        Preconditions.checkArgument(units != null, "units must be non-null");
        final Instant instant = units.toInstant(epochValue);
        return ZonedDateTime.ofInstant(instant, ZoneOffset.UTC);
    }
441201
public static OffsetDateTime parseDateTime(String date) throws ParseException {
        return DATE_TIME_OPTIONAL_OFFSET.withZone(ZoneOffset.UTC).parse(date, OffsetDateTime::from);
    }
558810
public static BigDecimal epoch(EvaluationContext ctx, Object datetime) {
        Instant instant = Conversions.toDateTime(datetime, ctx).toInstant();
        BigDecimal nanos = new BigDecimal(instant.getEpochSecond() * 1000000000 + instant.getNano());
        return nanos.divide(new BigDecimal(1000000000));
    }
26095
public DateTimeZone getZone(String id) {
        if (id == null) {
            return null;
        }

        Object obj = iZoneInfoMap.get(id);
        if (obj == null) {
            return null;
        }

        if (id.equals(obj)) {
            // Load zone data for the first time.
            return loadZoneData(id);
        }

        if (obj instanceof SoftReference<?>) {
            @SuppressWarnings("unchecked")
            SoftReference<DateTimeZone> ref = (SoftReference<DateTimeZone>) obj;
            DateTimeZone tz = ref.get();
            if (tz != null) {
                return tz;
            }
            // Reference cleared; load data again.
            return loadZoneData(id);
        }

        // If this point is reached, mapping must link to another.
        return getZone((String) obj);
    }
63584
public static SimpleTimeZone getCustomTimeZone(int offset) {
        boolean negative = false;
        int tmp = offset;
        if (offset < 0) {
            negative = true;
            tmp = -offset;
        }

        int hour, min, sec;

        if (ASSERT) {
            Assert.assrt("millis!=0", tmp % 1000 != 0);
        }
        tmp /= 1000;
        sec = tmp % 60;
        tmp /= 60;
        min = tmp % 60;
        hour = tmp / 60;

        // Note: No millisecond part included in TZID for now
        String zid = formatCustomID(hour, min, sec, negative);

        return new SimpleTimeZone(offset, zid);
    }
50293
public Chronology getChronology(Object object, DateTimeZone zone) {
        return getChronology(object, (Chronology) null).withZone(zone);
    }
316232
public static String formatIsoDate(ZonedDateTime value) {
        if (value == null) {
            return null;
        }

        // to match the format we get from Python's .isoformat(), we don't include second fraction if it's zero
        if (value.getNano() == 0) {
            return ISO_DATETIME_FORMAT_NO_SECOND_FRACTION.format(value);
        }

        return ISO_DATETIME_FORMAT.format(value);
    }
284077
public ZonedDateTime getEndZonedDateTime() {
        if (zonedEndDateTime == null) {
            zonedEndDateTime = ZonedDateTime.of(endDate, endTime, zoneId);
        }

        return zonedEndDateTime;
    }
796740
@Override
    @SuppressWarnings("unchecked")
    public ChronoZonedDateTime<AccountingDate> zonedDateTime(TemporalAccessor temporal) {
        return (ChronoZonedDateTime<AccountingDate>) super.zonedDateTime(temporal);
    }
161134
public static ZonedDateTime convertToZonedDateTime(final String value) {
        val dt = DateTimeUtils.zonedDateTimeOf(value);
        if (dt != null) {
            return dt;
        }
        val lt = DateTimeUtils.localDateTimeOf(value);
        return DateTimeUtils.zonedDateTimeOf(lt.atZone(ZoneOffset.UTC));
    }
458645
public static final SimpleMutableDateTime now(ZoneId zoneId)
    {
        ZonedDateTime zdt = ZonedDateTime.now(zoneId);
        SimpleMutableDateTime smt = SimpleMutableDateTime.from(zdt);
        return smt;
    }
53574
public static DateTime toDateTime(Instant instant, String timeZoneId) {
    return dateTimesHelper.toDateTime(instant, timeZoneId);
  }
1300165
public ZonedDateTime getAsNullableDateTime(String key) {
		Object value = getAsObject(key);
		return DateTimeConverter.toNullableDateTime(value);
	}
681168
public static LocalDateTime toLocalDateTime(Date date)
	{
		if(date == null)
			return null;
		
		return date.toInstant().atZone(ZoneId.systemDefault())
		.toLocalDateTime();
	}
630751
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) {
        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId);
    }
557687
static ZonedDateTime getDateFromStringToZoneId(String date, ZoneId zoneId, DateTimeFormatter formatter) throws DateTimeParseException {
        try {
            //noticed that date not parsed with non-US locale. For me this fix is helpful
            LocalDate localDate = LocalDate.parse(date, formatter);
            ZonedDateTime usDate = localDate.atStartOfDay(zoneId);
            return usDate.withZoneSameInstant(zoneId);
        } catch (Exception e) {
            //In case the parsing fail, we try without time
            try {
                ZonedDateTime usDate = LocalDate.parse(date, formatter).atStartOfDay(ZoneId.of(Constants.SHERDOG_TIME_ZONE));
                return usDate.withZoneSameInstant(zoneId);
            } catch (DateTimeParseException e2) {
                return null;
            }
        }
    }
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;
    }