Java Date Now getCurrentTime(String timeFormat)

Here you can find the source of getCurrentTime(String timeFormat)

Description

get Current Time

License

Open Source License

Declaration

public static String getCurrentTime(String timeFormat) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static String getCurrentTime() {
        return getCurrentTime(null);
    }// w ww. j av  a 2s  .  c o m

    public static String getCurrentTime(String timeFormat) {
        if (timeFormat == null) {
            timeFormat = "MM/dd/yyy hh:mm:ss";
        }
        return new SimpleDateFormat(timeFormat).format(new Date());
    }
}

Related

  1. getCurrentTime(String formatter)
  2. getCurrentTime(String pattern)
  3. getCurrentTime(String pattern)
  4. getCurrentTime(String pattern)
  5. getCurrentTime(String pattern)
  6. getCurrentTime2MysqlDateTime()
  7. getCurrentTimeAndDate()
  8. getCurrentTimeAsNumber()
  9. getCurrentTimeAsString()