java.text.SimpleDateFormat getDateFormatSymbols()

Description :

This java example shows how to use the getDateFormatSymbols() method of SimpleDateFormat class of java.text package. This method gets a copy of the date and time format symbols of this date format..

Method Syntax :

 public DateFormatSymbols getDateFormatSymbols()

Parameter Input :

DataType Parameter Description

Method Returns :

This method returns DateFormatSymbols.

Compatibility Version :

Requires Java 1.2 and up

Exception :


Java Code Example :

This java example source code demonstrates the use of getDateFormatSymbols() method of SimpledDateFormat class. This method is very helpful since it returns DateFormatSymbols which gives way to more helpful method such as getting the Zones, Months, etc. Below is an example that shows how to use the returned DateFormatSymbols to give information on acceptable zones of this formatter.


import java.text.DateFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Arrays;

 * This example source code demonstrates the use of  
 * getDateFormatSymbols() method 
 * of SimpleDateFormat class

public class GetDateFormatSymbolsExample {

	public static void main(String[] args) {

		// Initialize the formatter
		SimpleDateFormat sdf = new SimpleDateFormat();

		// get DateFormatSymbols
		DateFormatSymbols dateFormat = sdf.getDateFormatSymbols();

		// Print the DateFormatSymbols
		// that is recognizable by this formatter
		System.out.println("Available Date Format Symbols:"
				+ dateFormat.getLocalPatternChars());

		// get the symbol that corresponds to Zone
		String[][] list =  dateFormat.getZoneStrings();
		for(String[] s: list){


Sample Output :

Running the getDateFormatSymbols() method example source code of Calendar class will give you the following output:

SimpleDateFormat getDateFormatSymbols() method example

SimpleDateFormat getDateFormatSymbols() method example

Exception Scenario :


Similar Method :

  • N/A

Suggested Reading List :

References :