日期的简单处理

import java.util.Calendar;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class DATETest {
 public static void main(String[] args) throws ParseException {
  Calendar calendar = Calendar.getInstance();
  SimpleDateFormat adf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  Date date = adf.parse("2011-05-26 23:54:12");
  calendar.setTime(date);
  System.out.println(calendar.getTime());
  calendar.add(Calendar.MINUTE, 10);
  System.out.println(adf.format(calendar.getTime()));

 }

posted @ 2011-05-26 13:58  采姑娘的蘑菇  阅读(141)  评论(0编辑  收藏  举报