Java Regular Expression Tutorial
Powered by MaxBlogPress  
Currently browsing tag

simpledateformat patterns

SimpleDateFormat Example with Formats, Patterns and Date Conversion

SimpleDateFormat is the Java class for formatting and parsing dates with Locale support. You can format date to text and vice-versa using SimpleDateFormat class.

This class is very useful in formatting date to display in UI in specific pattern. SimpleDateFormat is the concrete class that extends DateFormat abstract class.

Date and Time formats are specified by patterns, which are nothing but a String. In pattern every letter has its specific meaning. For example, y is for year, M is for month in year and m is for minutes in Hour.

In the below attached code, we will see the different usage of SimpleDateFormat class with different string patterns.