Date & Time
Practically in all applications, there is a need to deal with date and time. This library provides two classes (DateTime and Timestamp) to hold data and perform operations such as adding minutes, hours, etc., comparing dates, rounding up/down, etc.
- DateTime - Has an attribute for each component, i.e., day, weekday, month, year, hours, minutes, seconds and milliseconds.
- Timestamp - Has only one attribute specifying number of milliseconds since 01/01/0001 00:00:00.000.
Both structures can be used to hold date and time information. However, there is a trade-off between them in terms of memory utilization, running time and convenience of debugging. Specifically, the DateTime is convenient for programming since attributes representing date/time components are easily accessible in the debug mode, while understanding the date and time from the Timestamp is not straightforward. On the other hand, Timestamp takes less memory than DateTime. As for the running time, some operations are faster in the DateTime while others are faster in Timestamp. For convenience, the library also provides functionality to switch between objects either by calling appropriate function or simply using overloaded "=" operator.
Besides directly assigning values to appropriate attributes, developers can also supply a string representing the date/time together with the parsing format, and the library can set up the object accordingly. Besides a variety of standard functions designed to operate with date and time, the library provides functions that do not exist in other tools, e.g., rounding up/down to nearest minute, hour, etc., round up/down to the end/start of a specified interval, etc.