Date praseDate = formatter_date.parse(this.txtSetRoundDate
.getText().toString());
final Calendar c = Calendar.getInstance();
c.getTime();
formatter_date.format(c.getTime());
Date date = formatter_date.parse(this.txtSetRoundDate.getText().toString());
Asked
Active
Viewed 126 times
-2

Naveen Tamrakar
- 3,349
- 1
- 19
- 28

Peter Phyo
- 9
- 1
- 3
-
your question is unclear. – Haresh Chhelana Nov 21 '14 at 04:53
-
possible duplicate of [How to convert date saved in String format to Date format](http://stackoverflow.com/questions/3141264/how-to-convert-date-saved-in-string-format-to-date-format) here you should specify that in which format you need date. – GovindRathod Nov 21 '14 at 04:54
-
http://stackoverflow.com/questions/454315/how-do-you-format-date-and-time-in-android – IntelliJ Amiya Nov 21 '14 at 04:55
2 Answers
0
[I did not have enough points to comment, I just want to help.As the question is not clear so same as answer ].
I think you are asking format of the Android System. If so, thier are many ways of doing it:
One of the i like is:
final String format = Settings.System.getString(getContentResolver(), Settings.System.DATE_FORMAT);
if (TextUtils.isEmpty(format)) {
dateFormat = android.text.format.DateFormat.getMediumDateFormat(getApplicationContext());
} else {
dateFormat = new SimpleDateFormat(format);
}
Also, their are another ways like,
Format dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
String pattern = ((SimpleDateFormat) dateFormat).toLocalizedPattern();

Akhil
- 829
- 1
- 11
- 26

user3278897
- 984
- 10
- 23
0
public static String getCurrentDate() {
try {
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String currentTimeStamp = dateFormat.format(new Date()); // Find
// todays
// date
Log.e("currentTimeStamp", currentTimeStamp);
return currentTimeStamp;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
String Current_Date=getCurrentDate();

Akhil
- 158
- 5