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.
我想要一个像下面这样的输出
Nov 4, 2003 8:14 PM
我如何使用 simpleddateformat 实现它?
这应该可以解决问题:
SimpleDateFormat format = new SimpleDateFormat("MMM d, YYYY hh:mm a");
请阅读文档以获取更多信息。
您可以简单地使用:
Date date = new Date(); //expected date to display SimpleDateFormat format = new SimpleDateFormat("MMM d, yyyy hh:mm a"); System.out.print(format.format(date));
谢谢!