Here you can find the source of getTimeAsString(String timeFormatAsString)
public static String getTimeAsString(String timeFormatAsString)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getTimeAsString(String timeFormatAsString) { DateFormat timeFormat = new SimpleDateFormat(timeFormatAsString); Calendar calendar = Calendar.getInstance(); return timeFormat.format(calendar.getTime()); }//from www. j a v a2s . c o m }