public static void main(String[] argv) {
		// 使用默认时区和语言环境获得一个日历
		Calendar cale = Calendar.getInstance();
		// 将 Calendar 类型转换成 Date 类型
		Date tasktime = cale.getTime();
		// 设置日期输出的格式
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		// 格式化输出
		System.out.println(df.format(tasktime));  // 2017-12-11 15:05:07
	}

  

public static void main(String[] argv) {// 使用默认时区和语言环境获得一个日历Calendar cale = Calendar.getInstance();// 将 Calendar 类型转换成 Date 类型Date tasktime = cale.getTime();// 设置日期输出的格式SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 格式化输出System.out.println(df.format(tasktime));}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2021-09-26
  • 2022-01-21
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2022-02-07
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
相关资源
相似解决方案