1 package org.tigris.scarab.tools; 2 3 48 49 import java.util.Date ; 50 import java.text.DateFormat ; 51 import java.text.SimpleDateFormat ; 52 53 56 public class Format 57 { 58 61 public static final String DATE_TIME_FMT = "yyyy-MM-dd HH:mm"; 62 63 69 public static String getDate(DateFormat format, Date date) 70 { 71 return format.format(date); 72 } 73 74 78 public static String getDate(String format, Date date) 79 { 80 SimpleDateFormat newFormat = new SimpleDateFormat (format); 81 return newFormat.format(date); 82 } 83 84 88 public static String getNow(SimpleDateFormat format) 89 { 90 return getDate(format, new Date ()); 91 } 92 93 97 public static String getNow(String format) 98 { 99 return getDate(format, new Date ()); 100 } 101 } 102 | Popular Tags |