Java Utililty Methods OffsetDateTime

List of utility methods to do OffsetDateTime

Description

The list of methods to do OffsetDateTime are organized into topic(s).

Method

DateasDate(Calendar calendar)
as Date
return new Date(calendar.getTimeInMillis());
EcloneInternally(E source, Map visited)
clone Internally
if (source == null) {
    return null;
Class<?> clazz = source.getClass();
if (clazz.isEnum() || IMMUTABLES.contains(clazz)) {
    return source;
if (clazz == Date.class) {
...
intcompareChrono(TemporalAccessor date1, TemporalAccessor date2)
compare Chrono
return compareChrono(date1, date2, false);
intcompareOffsetDateTimes(OffsetDateTime offsetDateTime1, OffsetDateTime offsetDateTime2)
compare Offset Date Times
if (offsetDateTime1 == offsetDateTime2) {
    return 0;
if (offsetDateTime1 == null) {
    return -1;
if (offsetDateTime2 == null) {
    return 1;
...
OffsetDateTimeconvertDateToOffsetDateTime(Date date)
Converts the old Date to a new OffsetDateTime , taking the UTC offset into account.
return OffsetDateTime.ofInstant(date.toInstant(), ZoneId.of("UTC"));
StringgetCurrentISODate()
get Current ISO Date
return ms2OffsetDateTime(System.currentTimeMillis()).format(ISO_DATE);
StringgetDateTimeString(OffsetDateTime time)
Returns a prettier String-representation of a OffsetDateTime object
return time.format(dtFormatter);
OffsetDateTimegetNowOdt()
get Now Odt
return OffsetDateTime.now(ZoneOffset.UTC);
booleanhasZone(TemporalAccessor date)
has Zone
if (date == null) {
    return false;
if (date instanceof ZonedDateTime) {
    return true;
} else if (date instanceof OffsetDateTime) {
    return true;
} else if (date instanceof OffsetTime) {
...
OffsetDateTimenext(OffsetDateTime date, OffsetTime time)
next
OffsetDateTime newDate = date.with(time);
if (newDate.isBefore(date)) {
    return newDate.plusDays(1);
return newDate;