Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.sql.Timestamp;
import java.time.ZonedDateTime;

public class Main {

    public static void main(String[] args) {
        System.out.println(toTimestamp(ZonedDateTime.now()));
    }

    public static Timestamp toTimestamp(ZonedDateTime dateTime) {
        return new Timestamp(dateTime.toInstant().getEpochSecond() * 1000L);
    }

}