Here you can find the source of getCurrentDateTime()
public static String getCurrentDateTime()
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**/* w ww .j a v a 2 s .com*/ * Gets the current date time. * * @return the current date time */ public static String getCurrentDateTime() { String ranNum = ""; DateFormat formatter = new SimpleDateFormat("MMM"); SimpleDateFormat monthParse = new SimpleDateFormat("MM"); DateFormat dformatter = new SimpleDateFormat("DD"); SimpleDateFormat dateParse = new SimpleDateFormat("DD"); Calendar cal = Calendar.getInstance(); String month = Integer.toString(cal.get(Calendar.MONTH) + 1); String date = Integer.toString(cal.get(Calendar.DATE) + 1); try { ranNum = "_" + dformatter.format(dateParse.parse(date)) + formatter.format(monthParse.parse(month)) + "_" + Integer.toString(cal.get(Calendar.HOUR_OF_DAY)) + Integer.toString(cal.get(Calendar.MINUTE)); } catch (Exception e) { } return ranNum; } }