Dateformat Example


 

Dateformat Example

Java Date format: The Java Dateformat class is used to format the date/time in Java applications.

Java Date format: The Java Dateformat class is used to format the date/time in Java applications.

Dateformat Example

The Java Dateformat class is used to format the date/time in Java applications. You can use the Dateformat class while generating the report to format the date/time in required format.

To format a date for the current Locale, use one of the static factory methods:

String myString = DateFormat.getDateInstance().format(myDate);

DateFormat provides many class methods for obtaining default date/time formatters based on the default or a given locale and a number of formatting styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More detail and examples of using these styles are provided in the method description.

Here is the example of Dateformat class:

Thanks

Ads