首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

当前时间添1 和 SimpleDateFormat

2012-12-26 
当前时间加1 和 SimpleDateFormatCalendar c Calendar.getInstance()c.setTime(new Date())//设置当前

当前时间加1 和 SimpleDateFormat

Calendar c = Calendar.getInstance();c.setTime(new Date()); //设置当前日期c.add(Calendar.DATE, 1); //日期加1Date date = c.getTime(); //结果

?

var d = new Date(new Date().getTime()+1000*60*60*24);
alert(d.getFullYear() + "年" + (d.getMonth()+1) + "月" + d.getDate() + "日");

?

附: SimpleDateFormat用法SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String time = sdf.format(new Date());Date d = sdf.parse("2010-10-10 10:10:10");

http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html

热点排行