public class DefaultDateFormatPattern {
public static void main(String[] args) {
System.out.println(new Date());
}
}
The output is: Thu Jan 08 10:52:56 IST 2015
Is there any method in Java to get the pattern of the date it is showing ?
According to Java 8 toString()
method of Date
class the format is: EEE MMM dd HH:mm:ss zzz yyyy
.
You can try SimpleDateFormat.toLocalizedPattern() or SimpleDateFormat.toPattern() to get the pattern.
SimpleDateFormat format=new SimpleDateFormat();
System.out.println(format.toLocalizedPattern());
System.out.println(format.toPattern());
Pass locale to get the locale specific pattern.
Read similar post
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