I am trying to use the Android SimpleDateFormat
like this:
String _Date = \"2010-09-29 08:45:22\"
SimpleDateFormat fmt = new SimpleDateFormat(\"
It took a lot of efforts. I did a lot of hit and trial and finally I got the solution. I had used ""MMM"" for showing month as: JAN
Here is an easy example of SimpleDateFormat
tried in Android Studio 3 and Java 9:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String strDate = sdf.format(strDate);
Note:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
shows some deprecation warning in Android Studio 3 Lint. So, add a second parameterLocale.US
to specify the Localization in date formatting.