Java SQL Date Create getSqlDate()

Here you can find the source of getSqlDate()

Description

get Sql Date

License

Open Source License

Declaration

public static java.sql.Date getSqlDate() 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {

    public static java.sql.Date getSqlDate() {
        return new java.sql.Date(getTime());
    }/*from   w  ww. ja  va2 s.c  o m*/

    public static long getTime() {
        java.util.Date dt = new java.util.Date();
        return dt.getTime();
    }

    public static String getTime(String s) {
        if (s == null || s.equals(""))
            return "";
        String s1 = "";
        try {
            SimpleDateFormat simpledateformat = new SimpleDateFormat(s);
            s1 = simpledateformat.format(Calendar.getInstance().getTime());
        } catch (Exception exception) {
            System.out.println(Calendar.getInstance().toString() + "cannot format time [function:getTime(String)]");
            exception.printStackTrace();
        }
        return s1;
    }
}

Related

  1. castToSqlDate(Object value)
  2. getSqlCurrentDate()
  3. getSqlCurrentDate()
  4. GetSqlDate()
  5. getSqlDate()
  6. getSQLDate()
  7. getSysDate()
  8. getSysDate()
  9. getSysdate(String format)