Java tutorial
//package com.java2s; // Licensed under the MIT license. import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { private static String getLogHeader() { DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.US); return "[" + dateFormat.format(Calendar.getInstance().getTime()) + "] "; } }