XDate – Better Javascript Date Handling

It’s a long-standing tradition among programming languages to make dealing with dates as horrific as possible. Sure, that may be a bit of an exaggeration  but looking at how Java, Javascript, PHP, C#, etc choose to handle dates and time can make a grown man cry. I mean, whoever thought using “Y-m-d H:i:s” to format a standard datetime in PHP was a good idea should never be allowed near a computer again. “Y-m-d”, that makes sense, but “H:i:s”? Seriously, we couldn’t just use a capital M for months and a lower case m for minutes? Ugghhh… anyways. Fortunately, there are ways to improve this.

For Java, there’s the popular Joda Time. There’s been a push for years now to get that to become the default Date Time handler for Java, or at least something based on it, but that still hasn’t occurred.

For Javascript, there are a couple of nice options as well. I haven’t played with it much, but Moment.js seems to do some interesting things. The one I have played with a little more is XDate. XDate is another product from Adam Shaw, who is also the author of the very nice FullCalendar plugin.

If you’re looking for an improved Javascript Date library, I would highly suggest it. It functions as a wrapper around the existing Date, while enhancing things like UTC handling and Date parsing, formatting, and manipulation. The XDate website does a very good job of providing a quick overview of the included functionality.

This entry was posted in jQuery / Javascript, Web Development and tagged , . Bookmark the permalink.

Leave a Reply

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