Java Date Now getCurrentDateInSqlFormat()

Here you can find the source of getCurrentDateInSqlFormat()

Description

get Current Date In Sql Format

License

Open Source License

Declaration

public static String getCurrentDateInSqlFormat() 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static final SimpleDateFormat SQL_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String getCurrentDateInSqlFormat() {
        Date currentDate = new Date();

        return dateToSqlFormat(currentDate);
    }/*from www  .  j av  a  2 s. c o  m*/

    public static String dateToSqlFormat(Date date) {
        return SQL_DATE_FORMAT.format(date);
    }
}

Related

  1. getCurrentDateByString(String datePattern)
  2. getCurrentDateDBFormat()
  3. getCurrentDateFormat()
  4. getCurrentDateFormated()
  5. getCurrentDateInMillis()
  6. getCurrentDateINYYYY_MM_DD()
  7. getCurrentDateInyyyyMMddFormat()
  8. getCurrentDateINYYYYMMDDHHMMSSwithColons()
  9. getCurrentDateMMDDYYYY()