Java ZonedDateTime Create toZonedDateTime(Object cell)

Here you can find the source of toZonedDateTime(Object cell)

Description

to Zoned Date Time

License

Open Source License

Declaration

public static ZonedDateTime toZonedDateTime(Object cell) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class Main {
    public static ZonedDateTime toZonedDateTime(Object cell) {
        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(toLong(cell)), ZoneId.systemDefault());
    }// www . j  a  va2 s .c  om

    public static Long toLong(Object cell) {
        if (cell instanceof Long) {
            return ((Long) cell);
        } else if (cell instanceof Integer) {
            return new Long((Integer) cell);
        } else if (cell instanceof String) {
            return Double.valueOf((String) cell).longValue();
        } else {
            return null;
        }
    }
}

Related

  1. toZonedDateTime(@Nullable Date date, @Nullable TimeZone zone)
  2. toZonedDateTime(Date utilDate)
  3. toZonedDateTime(long epochSeconds)
  4. toZonedDateTime(long systemMillis)
  5. zonedDateTime(String date, ZoneId zoneId)
  6. zonedDateTimeOf(final ZonedDateTime time)
  7. zonedDateTimeToYyyyMMdd(LocalDate localDate)