⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datetool.java

📁 struts的一些用的书籍
💻 JAVA
字号:
package app04c.util;

/**
 * A utility class for parsing and formatting dates using the default pattern.
 * If you need more than simple parsing and formatting,
 * you can obtain the underlying java.text.DateFormat object.
 */
import java.util.Date;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class DateTool {
  private static DateFormat dateFormat;
  public DateTool(String datePattern) {
    dateFormat = new SimpleDateFormat(datePattern);
    dateFormat.setLenient(false);
  }
  public static Date parse(String dateString) throws ParseException {
    return dateFormat.parse(dateString);
  }
  public static String format(Date date) {
    return dateFormat.format(date);
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -