Here you can find the source of getCurrentFormattedTime()
public static String getCurrentFormattedTime()
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String TIME_FORMAT = "HH:mm:ss"; public static String getCurrentFormattedTime() { return getFormattedTime(new Date()); }// ww w . j a v a2 s . com public static String getFormattedTime(Date time) { return new SimpleDateFormat(TIME_FORMAT).format(time); } }