java获取当前的具体时间(年月日时分秒)

版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/88679804

年:yyyy

月:MM

日:dd

时:HH

分:mm

秒:ss

package cn.com.listen;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.hibernate.SessionFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Test {
public static void main(String[] args) {
	Date dd=new Date();
	//格式化
	SimpleDateFormat sim=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	String time=sim.format(dd);
	System.out.println(time);
}
}

猜你喜欢

转载自blog.csdn.net/qq_37591637/article/details/88679804