Java SQL Time dateTimeToStr(java.util.Date date)

Here you can find the source of dateTimeToStr(java.util.Date date)

Description

date Time To Str

License

Open Source License

Declaration

public static String dateTimeToStr(java.util.Date date) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    private static final String SimpleDateTimeFormat = "yyyy-MM-dd HH:mm:ss";

    public static String dateTimeToStr(java.sql.Date sqlDate) {
        if (sqlDate == null) {
            return null;
        } else {//from  ww w.  j a  v a  2  s .  c  o  m
            return (new SimpleDateFormat(SimpleDateTimeFormat)).format(sqlDate);
        }
    }

    public static String dateTimeToStr(java.util.Date date) {
        if (date == null) {
            return null;
        } else {
            return (new SimpleDateFormat(SimpleDateTimeFormat)).format(date);
        }
    }
}

Related

  1. compareTime(String time1, String time2)
  2. createTime(int hour, int minute, int second)
  3. dateTime2str(java.sql.Date date)
  4. dateTimeFormat(Date date,String pattern)
  5. DateTimeSpace(String starttime, String endtime)
  6. daytime()
  7. deserializeSqlTime(String text)
  8. double2Time(Number zahl)
  9. equalsTime(Time time1, Time time2)