Java SQL Date Get getDate()

Here you can find the source of getDate()

Description

RETURN DATE

License

Open Source License

Declaration

public static String getDate() 

Method Source Code


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

import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class Main {
    /************************************************************
     * RETURN DATE/*w  w w  .  j  a va 2s . co m*/
     ************************************************************/
    public static String getDate() {
        Timestamp ts = null;

        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String d = sdf.format(new java.util.Date());
            ts = Timestamp.valueOf(d);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        return ts.toString().substring(8, 10);
    }
}

Related

  1. getDate()
  2. getDate()
  3. getDate()
  4. getDate()
  5. getDate()
  6. getDate()