java获取当前的具体时间(年月日时分秒)
年: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);
}
}
您的支持是我分享的动力
还没有评论,来说两句吧...