Here you can find the source of todaysTime()
public static String todaysTime() throws Throwable
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*from w w w. j a va 2 s . c o m*/ * Get today's time in format DD-MMM-YYYY-HH:MM:SS */ public static String todaysTime() throws Throwable { Date date = new Date(); SimpleDateFormat formatterOut = null; formatterOut = new SimpleDateFormat("dd-MMM-yyyy-HH:mm:ss"); return formatterOut.format(date); } }