SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
将Date型数据转化成为String类型
String s_date=[color=red]sdf.format[/color](new Date());
将String型数据转化成为Date类型
Date d_date=sdf.[color=red]parse[/color](s_date);
备注:
比较两个时间可以用
Date [color=red]date_1[/color]= new Date();
Date [color=red]date_2[/color]= new Date();
Boolean: [color=red]date_1[/color].before([color=red]date_2[/color]) [color=red]date_2[/color].after([color=red]date_1[/color]);
另附:
java程序Nextmonth.zip
Oracle中的日期变更 日期转换.zip
将Date型数据转化成为String类型
String s_date=[color=red]sdf.format[/color](new Date());
将String型数据转化成为Date类型
Date d_date=sdf.[color=red]parse[/color](s_date);
备注:
比较两个时间可以用
Date [color=red]date_1[/color]= new Date();
Date [color=red]date_2[/color]= new Date();
Boolean: [color=red]date_1[/color].before([color=red]date_2[/color]) [color=red]date_2[/color].after([color=red]date_1[/color]);
另附:
java程序Nextmonth.zip
Oracle中的日期变更 日期转换.zip