I am looking for high performance Java library that provides methods that allows me to get:
- Current hour (0-24)
- Current day (1-31)
- Current week (1-52)
- Current month (1-12)
- Current season (1-4)
- Current year (YYYY or YY)
Performance is a most important issue for me. This is why I cannot use standard Calendar class. The best would be solution that does all calculations without creating new objects.
ADDED: To clarify I will mention one more time: more that 100000 operations per second.
You could actually use the excellant joda-time library to do this. The
Chronologyimplementations in joda provide the logic behind the DateTimegetHourgetDaytype methods. There is no problem using it directly if you wish to skip creatingDateTimeinstants.Session isn’t something that joda has a concept of. You will have to work it out from the month given your own rules.
See joda-time documentation on Chronology