Jeff Miller

Team to Create Outside the Box

AdvancedCalendar – java.util.Calendar java.util.Date java.text.SimpleDateFormat

Every get tired of converting from Dates to Calendars and then need to use SimpleDateFormat to output it as a String?  How about parsing a string and getting a Date object?  Personally after a single project that had several  date time stamps that required manipulation I grew very tired of this.  So I introduce you to AdvancedCalendar.  It combines java.util.Calendar, java.util.Date, and java.text.SimpleDateFormat into a single class.  Here are some of the features I find useful:

  • Static parse() methods for converting a String date time into an AdvancedCalendar object.
  • Multiple constructors taking Calendar, and Date objects.
  • Ability to specify an output format on the object.
  • Manipulate the date time within a single object.
  • Functional Methods return the object for chaining actions.

I didn’t want to just simplify the usage of these three classes, I wanted to improve upon their functionality to make it easier in use.  Now we have one single class that is extensible. While we can discuss the merits of combining these into a single class or not, sometimes it’s just nice to work with a single object.

If you come up with any cool enhancements please share them back here!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.