Here you can find the source of getFormattedTime()
public static String getFormattedTime()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getFormattedTime() { DateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); return format.format(new Date()); }/*from ww w . j av a 2 s . co m*/ public static String getFormattedTime(String withFormat) { DateFormat format = new SimpleDateFormat(withFormat); return format.format(new Date()); } }