I wanted to get the current time in seconds. I found 3 approaches. But confused which one will be the best option.
long usingEpochSecond = Instant.now().getEpochSecond();
long usingDate1 = TimeUnit.MILLISECONDS.toSeconds(new Date().getTime());
long usingDate2 = new Date().getTime()/1000
Which one is the best solution? Is there an even better option?