Here you can find the source of timeString()
public static String timeString()
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final SimpleDateFormat FORMATTER = new SimpleDateFormat("HH:mm:ss"); public static String timeString() { return timestampToString(System.currentTimeMillis()); }//ww w . ja v a 2 s .c o m public static String timestampToString(long timestamp) { return FORMATTER.format(new Date(timestamp)); } }