Java Date Now getCurrentTimeInMySqlTime()

Here you can find the source of getCurrentTimeInMySqlTime()

Description

get Current Time In My Sql Time

License

Open Source License

Declaration

public static String getCurrentTimeInMySqlTime() 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

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

    public static String getCurrentTimeInMySqlTime() {
        SimpleDateFormat sdf = new SimpleDateFormat(_16DIGIT_DATE_TIME_MYSQL);

        return sdf.format(new Date());
    }//from   w  ww. j a  v  a 2 s.co m

    public static String format(Date aDate, String type) {
        SimpleDateFormat sdf = new SimpleDateFormat(type);

        return sdf.format(aDate);
    }

    public static String format(Long dateMs, String type) {
        Date date = new Date(dateMs);
        SimpleDateFormat sdf = new SimpleDateFormat(type);
        return sdf.format(date);
    }
}

Related

  1. getCurrentTimeForFileName()
  2. getCurrentTimeForLog()
  3. getCurrentTimeForName()
  4. getCurrentTimeForUseInAFileName()
  5. getCurrentTimeInMySqlTime()
  6. getCurrentTimeInString(SimpleDateFormat dateFormat)
  7. getCurrentTimeInString(String format)
  8. getCurrentTimeNoHour()
  9. getCurrentTimeNumber()