Java SQL Time dateTime2str(java.sql.Date date)

Here you can find the source of dateTime2str(java.sql.Date date)

Description

date Timestr

License

Apache License

Declaration

static public String dateTime2str(java.sql.Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

public class Main {
    static public SimpleDateFormat MMddYYYY_HHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    static public String dateTime2str(java.sql.Date date) {
        if (date == null)
            return "";
        try {/*  www .ja  va 2 s.  c  o  m*/
            return MMddYYYY_HHmmss.format(date);
        } catch (Exception e) {
            return "";
        }
    }

    static public String dateTime2str(java.sql.Timestamp date) {
        if (date == null)
            return "";
        try {
            return MMddYYYY_HHmmss.format(date);
        } catch (Exception e) {
            return "";
        }
    }
}

Related

  1. compareTime(String time1, String time2)
  2. createTime(int hour, int minute, int second)
  3. dateTimeFormat(Date date,String pattern)
  4. DateTimeSpace(String starttime, String endtime)
  5. dateTimeToStr(java.util.Date date)
  6. daytime()