I have a use case to parse string to Date for different styles(short, Medium or Full) and locale(US,UK..). so I have used DateFormat.getDateInstance(style,locale) to parse the string to date, while parsing it is throwing Unparseable exception for "2015/08/14@10:00:00:GMT" except DateFormat.MEDIUM style.i want to how to parse the same string to date for DateFormat.SHORT or DateFormat.FULL style.
import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;
public class Testing {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
DateFormat formatter = DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.US);
Date sd = formatter.parse("2015/08/14@10:00:00:GMT");
}
}
In above code if i modify DateFormat.MEDIUM to DateFormat.SHORT or DateFormat.FULL, it is not parsing the string to date.