Question

Is there any single line java command using joda to get seconds in a year?

I tried various combinations but not seems to be working.

What I tried is

    System.out.println("Seconds in a day: " + Days.ONE.toStandardSeconds().getSeconds());
Was it helpful?

Solution

I was looking on stackoverflow and come across this How can I get the number of days in a year using JodaTime?

got the idea

new DateTime().year().toInterval().toDuration().getStandardSeconds()

and it works for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top