//String to date Public Static voidDT7 ()throwsparseexception {String str_date= "------08"; DateFormat DT=NewSimpleDateFormat ("Yyyy--mm--dd"); Date Date=Dt.parse (str_date); SYSTEM.OUT.PRINTLN (date); } Public Static voidDT6 ()throwsparseexception {String str_date= "August 08, 2015"; DateFormat DT=dateformat.getdateinstance (Dateformat.long); Date Date=Dt.parse (str_date); SYSTEM.OUT.PRINTLN (date); } Public Static voidDa3 ()throwsparseexception {String str_date= "2015-08-08"; DateFormat DT=dateformat.getdateinstance (); Date Date=Dt.parse (str_date); SYSTEM.OUT.PRINTLN (date); } //Date to String Public Static voiddt3 () {Date dt=NewDate (); DateFormat DTF=NewSimpleDateFormat ("Yyyy-mm-dd"); String s=dtf.format (DT); System.out.println (s); } Public Static voidDT2 () {Date dt=NewDate (); DateFormat DTF=dateformat.getdateinstance (Dateformat.long); String s=dtf.format (DT); System.out.println (s); } Public Static voidcl () {LongTime=System.currenttimemillis (); Date DT=NewDate (20151440592355603l); System.out.print (DT); System.out.print (time); }
Java Date operation