Dates and Times

The primary class for representing an instance of time in Java is java.util.Date. Many of the methods in Date are deprecated and replaced by functionality contained in the java.util.Calendar and java.text.DateFormat classes. The .NET mechanism for representing an instant of time is the System.DateTime struct. Instances of DateTime are always associated with an instance of System.Calendar. This relationship allows DateTime to provide functionality equivalent to a combination of the Java Date and Calendar classes. Through implementation of the IFormattable interface, described in Chapter 7, and methods to parse string values, the .NET DateTime class includes functionality comparable to the Java DateFormat class.

A number of fundamental ...

Get C# for Java Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.