Get Current Unix Timestamp using Java

System.currentTimeMillis method

package app;

public class Main
{
    public static void main(String[] args)
    {
        long timestamp = System.currentTimeMillis() / 1000L;

        System.out.println(timestamp);
    }
}

Leave a Comment

Cancel reply

Your email address will not be published.