java日期转换

Date()转timestamp:

[java] view plain copy
print?

    new Timestamp((new Date()).getTime()) 


timestamp转Date():

[java] view plain copy
print?

    Timestamp t = new Timestamp(System.currentTimeMillis()); 
                //System.out.println(t); 
                 
                 
                Date d = new Date(t.getTime()); 

猜你喜欢

转载自857202539.iteye.com/blog/2377615