EPOCH Time in Java

1. How can I get the current time in epoch?

long milliseconds =  System.currentTimeMillis();

2. How will I truncate the second part of epoch time?

 long milliseconds =  System.currentTimeMillis();
 System.out.println(new Date(milliseconds - (milliseconds%(1000*60))));

No comments:

 My Attempt to learn AI  GPT Generative Pretrained Transformer Created by Google in 2017 with the publication of the paper "Attention ...

Popular in last 30 days