get Date yyyyMMddHHmm - Java java.util

Java examples for java.util:Date Format

Description

get Date yyyyMMddHHmm

Demo Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getDateMMDDHHMI());
    }//from   w ww  . j  ava  2  s.  co m

    public static String getDateMMDDHHMI() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmm");
        String curDate = formatter.format(Calendar.getInstance().getTime());
        return curDate;
    }
}

Related Tutorials