Here you can find the source of getNowString()
public static String getNowString()
//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; } }