Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 simpleDateformat 我必须将 Date 对象格式化如下
2010 年 9 月 2 日。下午 16:55
dd-MMM-yy. HH:mma
但是下午 16 点没有意义——显然是下午。要么使用hh:mma,要么使用HH:mm
hh:mma
HH:mm
String DATE_FORMAT = "dd-EEE-yy. h:mm a" SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
by the way, 16:55 PM -- PM is not required... 4:55 PM would make sense :)