This is the code to get date format
GregorianCalendar calDate = new GregorianCalendar();
The constructor will hold value of format as 2015,7,15 what I want to achieve is to be able to set this format from a text field. For example
GregorianCalendar calDate = new GregorianCalendar(Formats.getText());
But I have errors and is not working. Please whats is right code?
Resolved with the below code
String nnhh= ""+Firstname.getText();
String someDate = ""+nnhh;
SimpleDateFormat sdf = new SimpleDateFormat("MM,dd,yyyy");
try {
Date date = sdf.parse(someDate);
long dd=date.getTime();
Firstname.setText(""+dd);} catch (ParseException e) {
e.printStackTrace();
}
and dd was in TimeInMillis just as I wanted. Thanks