convertDateFormat

おそらく今まで作ってきたシステムのほとんどで繰り返し書いてるメソッド。
効率化のためSimpleDateFormatのインスタンスをstatic変数にしてて失敗したこともあった。
このクラスってスレッドセーフじゃないんだよね・・・

public static String convertDateFormat(Date date, String format) {
    return new SimpleDateFormat(format).format(date);
}

public static Date convertDateFormat(String string, String format) throws ParseException {
    return new SimpleDateFormat(format).parse(string);
}