TimeSpan


#1

Is there an equivalent class to .NET TimeSpan class?

(btw the “seach the community” box doesn’t seems to work in the forum)


#2

Well, date/time management is not very well designed in JDK and we don't provide anything in Kotlin stdlib. You can try using JodaTime library, which works pretty well.


#3

If you're using JDK 8 the java.time package is included. It's an evolution of Joda Time. I think it's the Duration class you're looking for.

If you’re using JDK 7 you can use Joda Time or ThreeTen backport, which is a backport of java.time to JDK 7.

http://blog.joda.org/2014/07/threeten-backport-vs-joda-time.html