Java基础-时间类

关于java中六个时间类的使用和区别
java.util.Date
java.sql.Date ,java.sql.Time , java.sql.Timestamp
java.text.SimpleDateFormat
java.util.Calendar

java.util.Date日期格式为:年月日时分秒 
java.sql.Date日期格式为:年月日
java.sql.Time日期格式为:时分秒 
java.sql.Timestamp日期格式为:年月日时分秒纳秒(毫微秒)

     //创建当前时间
        Date date = new Date();
        Time time = new Time(date.getTime());
        //日期格式的转换
        SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
原文地址:https://www.cnblogs.com/ssjf/p/10072833.html