Here you can find the source of getTimeString()
public static String getTimeString()
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Main { public static String getTimeString() { // Create an instance of SimpleDateFormat used for formatting // the string representation of date (month/day/year) DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); // Get the date today using Calendar object. Date today = Calendar.getInstance().getTime(); // Using DateFormat format method we can create a string // representation of a date with the defined format. return df.format(today); }/*w w w .j av a2 s .com*/ }