...
| Code Block | ||||
|---|---|---|---|---|
| ||||
String myString = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).format( rightNow.getTime()); /* ...rest of code unchanged...*/ |
Compliant Solution (
...
Bypass Locale)
This compliant solution checks the date's MONTH attribute without formatting it. While date representations vary by culture, the contents of a Calendar date do not. Consequently, this code works in any locale.
...