Changing the world through software

Computing for the environment and Computational Linguistics

Dates and java

Leave a comment

java.util.Date is not perfect and a lot of the original methods have been deprecated yet people persist in using these methods. java.util.Calendar should be used (no that java.util.Calendar is any great shakes either).
I’ve seen a project in which the joda-time library was referenced, using Date.toString() and then using String.substring() to pull out the day month and year! If you see code like this on your project, buy the author a copy of ‘Effective Java’. There is no excuse for not using the API available to you correctly.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s