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:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days