Java Now nowDT()

Here you can find the source of nowDT()

Description

now DT

License

LGPL

Declaration

public static String nowDT() 

Method Source Code


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

import java.text.DateFormat;

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

public class Main {
    public static final String FMT_DEFAULT = "yyyy-MM-dd HH:mm:ss";
    private static final Map<String, SimpleDateFormat> MAP = new HashMap<String, SimpleDateFormat>(6);

    public static String nowDT() {
        return formatDT(FMT_DEFAULT);
    }/*from  w ww.j  av a2s  . c om*/

    public static String formatDT(String fmt) {
        return formatDT(fmt, new Date());
    }

    public static String formatDT(String fmt, Date date) {
        return getFmt(fmt).format(date);
    }

    public static DateFormat getFmt(String fmt) {
        return MAP.get(fmt);
    }
}

Related

  1. nowDate(String strFormat)
  2. nowDateString()
  3. nowDateString()
  4. nowDateString(String format)
  5. nowDateToString()
  6. nowDT()
  7. nowFile()
  8. nowFormat(String format)
  9. nowFormat(String format)