Is there an equivalent class to .NET TimeSpan class?

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


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.


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.