convert ZonedDateTime to millisecond(long). - Java java.time

Java examples for java.time:ZonedDateTime

Description

convert ZonedDateTime to millisecond(long).

Demo Code


//package com.java2s;

import java.time.ZonedDateTime;

public class Main {
    /**//  w w  w . j a  v  a2s. c om
     * convert ZonedDateTime to millisecond(long).
     * @param zdt ZonedDateTime Object.
     * @return millisecond(long)
     */
    public static long zoneDateTime2long(final ZonedDateTime zdt) {
        return zdt.toInstant().toEpochMilli();
    }
}

Related Tutorials