Java Hour Format formatMM(Date date)

Here you can find the source of formatMM(Date date)

Description

yyyy-MM-dd HH:mm

License

Apache License

Parameter

Parameter Description
date a parameter

Declaration

public static String formatMM(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private final static ThreadLocal<SimpleDateFormat> YYYY_MM_DD_HH_MM_FORMAT = new ThreadLocal<SimpleDateFormat>() {
        @Override//from ww  w .ja v a2  s  .c  om
        protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm");
        }

        ;
    };

    /**
     * yyyy-MM-dd HH:mm
     *
     * @param date
     * @return
     */
    public static String formatMM(Date date) {
        return YYYY_MM_DD_HH_MM_FORMAT.get().format(date);
    }
}

Related

  1. formatInfo(String info)
  2. formatInternal(final Date date)
  3. formatInterval(long intervalMsec)
  4. formatLastModified(long lastModifiedTime)
  5. formatMessage(String message)
  6. formatNanosTimeUSEastern(long nanos)
  7. formatNewDate(String format)
  8. formatOffset(int offset)
  9. formatOptimal(Date d)