以下实例演示了如何使用 Date 类及 SimpleDateFormat 类的 format(date) 方法来输出当前时间:
Main.java 文件
以上代码运行输出结果为:
现在时间:2015-03-27 21:27:28 下午