编程语言

img ziying

dodate

发表于2004/10/16 14:02:00  947人阅读

分类: jsp

DoDate.java

/*
format the date

*/

package wap;

import java.util.*;
import java.text.*;
import java.lang.*;


public class DoDate {

  public DoDate() {
  }

  public String formatDate1(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日 HH时mm分ss秒");
      String strDate = formatter.format(myDate);
      return strDate;
  }

  public String formatDate2(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("yyyy年MM月dd日");
      String strDate = formatter.format(myDate);
      return strDate;
  }

  public String formatDate3(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
      String strDate = formatter.format(myDate);
      return strDate;
  }

  public String formatDate4(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd");
      String strDate = formatter.format(myDate);
      return strDate;
  }

  public String formatDate5(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("yyyy/MM/dd");
      String strDate = formatter.format(myDate);
      return strDate;
  }

  public String formatDate6(Date myDate) {
      SimpleDateFormat formatter = new SimpleDateFormat ("MM-dd HH:mm");
      String strDate = formatter.format(myDate);
      return strDate;
  }
}

阅读全文
0 0

相关文章推荐

img
取 消
img