1、打开eclipse开发工具,项目中新建Java类DateFormat,勾选main主方法
2、打开新建的Java类DateFormat,定义类方法queryCurrentDate,返回值为字符串
3、在main主方法中,调用queryCurrentDate方法并赋值给date,并打印结果
4、保存代码并使用Java Application运行,结果可以看到日期时间格式化
5、调整queryCurrentDate方法中的值,直接返回st变量值
6、再次调用queryCurrentDate方法,赋值给字符串变量time并打印
7、再次保存代码并运行文件,可以看到当前格式化日期时间