Java Time Now getNowString()

Here you can find the source of getNowString()

Description

returns Now in String (HHMM format)

License

Apache License

Declaration

public static String getNowString() 

Method Source Code

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

import java.util.Date;

public class Main {
    /**//from www.j  av  a  2 s . c  o  m
     * returns Now in String (HHMM format)
     * 
     * @return
     */
    public static String getNowString() {
        return getTodayInFormat("HHmm");
    }

    /**
     * getTodayInFormat
     * @param format
     * @return
     */
    public static String getTodayInFormat(String format) {
        Date td = new Date();
        java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(format);
        String datenewformat = formatter.format(td);
        return datenewformat;
    }
}

Related

  1. getNowSinceHour()
  2. getNowStr()
  3. getNowStr()
  4. getNowStr()
  5. getNowStrDateVerbose()
  6. getNowString()
  7. getNowString(String pattern)
  8. getNowTime()
  9. getNowTime()