I need to format the date into a specific string.
I used SimpleDateFormat class to format the date using the pattern \"yyyy-MM-dd\'T\'HH:m
Simply refactor this code and replace the 'Locale.getDefault()' with the Locale you need
private SimpleDateFormat getDateFormat() {
SimpleDateFormat dateFormat = (SimpleDateFormat) SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.DEFAULT, Locale.getDefault());
String pattern = dateFormat.toLocalizedPattern();
pattern = pattern.trim();
dateFormat.applyLocalizedPattern(pattern);
return dateFormat;
}
//And here is the usage
SimpleDateFormat sdf = getDateFormat();
sdf.format(new Date());