數據庫中對日期對象的轉換

public class DateUtil
{
       private static SimpleDateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

      public static String getDateTimeString(Date date)
 {
     if (date == null)
       return "";
     return datetimeFormat.format(date);
 }
  public static Date getDateTimeDate(String times) throws ParseException{
  
    if (times == null)
         return datetimeFormat.parse(times);
   return null;
 }
}

發佈了37 篇原創文章 · 獲贊 13 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章