Share on Google+Share on Google+

Dateformat Example

Advertisement
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

Advertisements

Posted on: April 3, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Related Tutorials