Java Cookbook
DateFormat
Problem:
You want to format a date correctly for a locale.
Solution:
Formatting dates and times correctly for a locale can prove challenging, especially considering the variety of possibilities. Thankfully, Java provides a number of date formatting methods and classes. icu4j adds even more tools to the programmers toolbox.
To format a date you need to get an instance of the DateFormat class passing the locale in:
If you are testing any of these recipes in Eclipse and the characters are not displaying correctly in your console visit http://i18ncookbook.com/eclipse_settings.
This site is ad supported. I hope you find something among our sponsors worth clicking. ;)
i18n search
Custom Search