Java – Android simpledateformat does not work
•
Java
Quick questions, simpledateformat didn't perform as well as I expected I want to get a date string that looks like Thursday, November 29, 13:43
This is my format:
Calendar c = Calendar.getInstance(); _clockDateFormat = new SimpleDateFormat("cccc dd MMMM kk:mm"); _clockDateFormat.format(c.getTime());
This is the output:
5 29 11 13:43
What on earth did I do wrong?
Solution
Instead of using E:
Calendar c = Calendar.getInstance(); SimpleDateFormat _clockDateFormat = new SimpleDateFormat("EEEE dd MMMM kk:mm"); System.out.println(_clockDateFormat.format(c.getTime()));
Output:
For details, see documentation
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码