Java SQL Date Parse parseSqlDate(java.util.Date date)

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

Description

parse Sql Date

License

Open Source License

Declaration

public static java.sql.Date parseSqlDate(java.util.Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static java.sql.Date parseSqlDate(java.util.Date date) {
        if (date != null) {
            return new java.sql.Date(date.getTime());
        } else {//  ww  w . ja v  a2  s .co  m
            return null;
        }
    }

    public static String getTime(java.util.Date date) {
        return format(date, "HH:mm:ss");
    }

    public static String format(java.util.Date date, String format) {
        String result = "";
        try {
            if (date != null) {
                java.text.DateFormat df = new java.text.SimpleDateFormat(format);
                result = df.format(date);
            }
        } catch (Exception e) {
        }
        return result;
    }

    public static String format(java.util.Date date) {
        return format(date, "yyyy/MM/dd");
    }
}

Related

  1. parseDateYYMMddHHmmss1(Date date)
  2. parseDateyyyy_MM_DD(String ds)
  3. parseSqlDate(final String value)
  4. parseSqlDate(final String value)
  5. parseSqlDate(java.util.Date date)
  6. parseSQLDate(String dateStr, String pattern)
  7. parseString2Date(String s, SimpleDateFormat format)
  8. parseUTCDateFromString(String dt)
  9. parseUtilDateToSqlDate(Date date)