javastring轉(zhuǎn)日期格式 怎么把string類型轉(zhuǎn)換成date類型?
怎么把string類型轉(zhuǎn)換成date類型?代碼如下:public class date2string{@test public void test(){date date=new date()simp
怎么把string類型轉(zhuǎn)換成date類型?
代碼如下:
public class date2string{@test public void test(){date date=new date()
simpledateformat SDF=new simpledateformat(“yyyy-MM-DD”)系統(tǒng)輸出打印( sdf.format格式(date))
sdf=new SimpleDateFormat(“yyyy-MM-dd HH:MM:ss”)系統(tǒng)輸出打印( sdf.format格式(日期)sdf=新簡(jiǎn)化格式(“yyyy-MM-DD HH:MM:SS”)系統(tǒng)輸出打印( sdf.format格式(date)}
將數(shù)據(jù)轉(zhuǎn)換成字符串類型,可以轉(zhuǎn)換成“”yyyy-MM-DD HH:MM:SS”格式和“yyy-MM-DD HH:MM:SS”樣式。