I want to format dates with month names with localized label in different languages including Turkish,
how do I set formatted labels for months
The DateFormat class in Java is used for formatting dates. A specified date can be formatted into the Data/Time string. For example, a date can be formatted into: mm/dd/yyyy.
SimpleDateFormat – yyyy-M-d For legacy Java application, we use SimpleDateFormat and . setLenient(false) to validate a date format.
This format is defined by the sensible practical standard, ISO 8601. The T separates the date portion from the time-of-day portion. The Z on the end means UTC (that is, an offset-from-UTC of zero hours-minutes-seconds). The Z is pronounced “Zulu”.
MMM/DD/YYYY. Three-letter abbreviation of the month, separator, two-digit day, separator, four-digit year (example: JUL/25/2003) YY/DDD. Last two digits of year, separator, three-digit Julian day (example: 99/349)
Use the SimpleDateFormat
constructor taking a Locale
.
SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM yyyy", new Locale("tr"));
String date = sdf.format(new Date());
System.out.println(date); // 27 Eylül 2011
The Locale
accepts an ISO-639-1 language code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With