Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java equivalent to C#'s TimeSpan

Does Java have a data type that represents a period of time eg 34 seconds, 5 minutes etc.

I've seen a few implementations of a TimeSpan that cover a Time period like from the 10th of December to the 11th of December.

What I need is something like TimeSpan in C#.

like image 981
Omar Kooheji Avatar asked Jan 13 '09 17:01

Omar Kooheji


People also ask

What is the equivalent of pointers in Java?

Java doesn't have pointers; Java has references.

Does Java have unions?

The Java language does not support unions or direct control memory layout the way that languages like C do directly.

What is C and Java?

C is a compiled language that is it converts the code into machine language so that it could be understood by the machine or system. Java is an Interpreted language that is in Java, the code is first transformed into bytecode and that bytecode is then executed by the JVM (Java Virtual Machine).

What does the operator do in Java?

Operators are special symbols that perform specific operations on one, two, or three operands, and then return a result. As we explore the operators of the Java programming language, it may be helpful for you to know ahead of time which operators have the highest precedence.


1 Answers

Not a part of the JDK currently, but will be incorporated in JDK 7 - try Joda Time

like image 190
Electric Monk Avatar answered Sep 28 '22 00:09

Electric Monk