Calendar c = Calendar.getInstance();
String myDateString = (String) DateFormat.format("yyyy-MM-dd hh:mm", c.getTime());
dateTv.setText(myDateString);
The output is:
2014-02-13 04:31
The hour is actually not 04, it is 16, i mean it is after noun, not after midnight (4 in the morning) if you know what i mean.
Why is it happening and how coul i fix it?
E D I T:
For the lovely -1 voters:
As somebody suggested:
String myDateString = (String) DateFormat.format("yyyy-MM-dd HH:mm", c.getTime());
This solution gives me this exact String:
2014-02-13 HH:45
YES. There are 2 'H' characters in my hours. It is exactly a H character, not a number.