Java OffsetDateTime hasZone(TemporalAccessor date)

Here you can find the source of hasZone(TemporalAccessor date)

Description

has Zone

License

MIT License

Declaration

public static boolean hasZone(TemporalAccessor date) 

Method Source Code

//package com.java2s;
/*!//from  w  w w.ja  v  a 2 s  .c o  m
 * mifmi-commons4j
 * https://github.com/mifmi/mifmi-commons4j
 *
 * Copyright (c) 2015 mifmi.org and other contributors
 * Released under the MIT license
 * https://opensource.org/licenses/MIT
 */

import java.time.OffsetDateTime;
import java.time.OffsetTime;
import java.time.ZonedDateTime;

import java.time.temporal.TemporalAccessor;

public class Main {
    public static boolean hasZone(TemporalAccessor date) {
        if (date == null) {
            return false;
        }

        if (date instanceof ZonedDateTime) {
            return true;
        } else if (date instanceof OffsetDateTime) {
            return true;
        } else if (date instanceof OffsetTime) {
            return true;
        }

        return false;
    }
}

Related

  1. compareOffsetDateTimes(OffsetDateTime offsetDateTime1, OffsetDateTime offsetDateTime2)
  2. convertDateToOffsetDateTime(Date date)
  3. getCurrentISODate()
  4. getDateTimeString(OffsetDateTime time)
  5. getNowOdt()
  6. next(OffsetDateTime date, OffsetTime time)
  7. nowAtZone(String offsetId)
  8. parseDate(String raw)
  9. stringifyDate(long timestamp)