Java Date Now getCurrentDate(String format)

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

Description

get Current Date

License

Apache License

Declaration

public static String getCurrentDate(String format) 

Method Source Code

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

public class Main {
    public static String getCurrentDate(String format) {
        if (format == null || format.isEmpty())
            format = "yyyy.MM.dd'-'HH:mm:ss";
        java.text.DateFormat dateFormat = new java.text.SimpleDateFormat(format);
        java.util.Date date = new java.util.Date();
        String currDate = dateFormat.format(date);
        return currDate;
    }//from   www.ja va2 s.  co m
}

Related

  1. getCurrentDate(String format)
  2. getCurrentDate(String format)
  3. getCurrentDate(String format)
  4. getCurrentDate(String format)
  5. getCurrentDate(String format)
  6. getCurrentDate(String formatStr)
  7. getCurrentDate(String pattern)
  8. getCurrentDate(String pattern)
  9. getCurrentDate(String pattern)