Java SQL Date Get getDate(String format)

Here you can find the source of getDate(String format)

Description

get Date

License

Apache License

Declaration

public static String getDate(String format) 

Method Source Code


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

import java.sql.Timestamp;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static String TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static String getDate(String format) {
        String d = new SimpleDateFormat(format).format(Calendar.getInstance().getTime());
        return d;
    }//from   w w w  .j a v  a2  s .c  om

    public static Timestamp getTime() {
        String day = new SimpleDateFormat(TIME_FORMAT).format(Calendar.getInstance().getTime());
        return Timestamp.valueOf(day);
    }
}

Related

  1. getDate(ResultSet rs, String columnLabel)
  2. getDate(ResultSet rs, String columnName)
  3. getDate(String aDate, int dif)
  4. getDate(String date)
  5. getDate(String date)
  6. getDate(String pattern)
  7. getDate(String strDate)
  8. getDate(String theDateStr, int days)
  9. getDate(String value)