I'm having trouble figuring out an easy way to format a date based on the current user's locale without manually passing in a format
string. I realize you can do something like this:
DateFormat dateFormat = DateFormat.getDateInstance( DateFormat.SHORT, locale );
However, this does not get me what I want because DateFormat.SHORT is basically M/d/yy. For the default English_US Locale, I want my dates to look like MM/dd/yyyy. As you can see by the code below, I created a little hack to get this, but I feel like there's got to be a better and cleaner way to do this...right? Also, another issue I'm running into is that when I'm logged in as a users' locale which uses '-' instead of '/' (i.e. 21-01-2009), I get a parse exception, thrown by the parseDate method below. Can anyone provide any input? Thanks.