Here you can find the source of getTimeNow(Date theTime)
Parameter | Description |
---|---|
theTime | the current time |
public static String getTimeNow(Date theTime)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String timePattern = "HH:mm"; /**/*from w ww . j ava2 s.c om*/ * This method returns the current date time in the format: MM/dd/yyyy HH:MM * a * * @param theTime * the current time * @return the current date/time */ public static String getTimeNow(Date theTime) { return getDateTime(timePattern, theTime); } /** * This method generates a string representation of a date's date/time in * the format you specify on input * * @param aMask * the date pattern the string is in * @param aDate * a date object * @return a formatted string representation of the date * * @see java.text.SimpleDateFormat */ public static final String getDateTime(String aMask, Date aDate) { SimpleDateFormat df = null; String returnValue = ""; df = new SimpleDateFormat(aMask); returnValue = df.format(aDate); return (returnValue); } }