Java SQL Date Convert dateToStr(java.util.Date date)

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

Description

date To Str

License

Open Source License

Declaration

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

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    private static final String simDateFormat = "yyyy-MM-dd";

    public static String dateToStr(java.sql.Date sqlDate) {
        if (sqlDate == null) {
            return null;
        } else {/*from  w w  w.j ava  2  s  . c o  m*/
            return (new SimpleDateFormat(simDateFormat)).format(sqlDate);
        }
    }

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

Related

  1. dateToSqlDate(Date date)
  2. DateToSQLDate(Date pDate)
  3. dateToSQLDate(java.util.Date d)
  4. dateToStamp(String date)
  5. dateToSTR(Date data, String formato)
  6. dateToString(Date date)
  7. dateToString(Date date, String format)
  8. dateToString(java.sql.Date d)
  9. dateToString(java.sql.Date data)