Java SQL Date From toDateStr(java.util.Date d)

Here you can find the source of toDateStr(java.util.Date d)

Description

to Date Str

License

Apache License

Declaration

public static String toDateStr(java.util.Date d) 

Method Source Code

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

import java.text.SimpleDateFormat;

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

    public static String toDateStr(java.sql.Date d) {
        if (d == null) {
            return null;
        } else {/*from  w w w  . ja va 2  s. c o m*/
            return (new SimpleDateFormat(Simple_Date_Format)).format(d);
        }
    }

    public static String toDateStr(java.util.Date d) {
        if (d == null) {
            return null;
        } else {
            return (new SimpleDateFormat(Simple_Date_Format)).format(d);
        }
    }
}

Related

  1. toDate(Object value)
  2. toDate(String dateString)
  3. toDate(String s)
  4. toDateFromString(String str)
  5. toDateMidnight(java.util.Date d)
  6. toSqlDate(Calendar calendar)
  7. toSqlDate(Date date)
  8. toSqlDate(Date date)
  9. toSqlDate(Date date)