Here you can find the source of getTimeString(java.util.Date date)
Parameter | Description |
---|---|
date | a parameter |
public static String getTimeString(java.util.Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/* w ww. j a va2s .c om*/ * @param date * @return */ public static String getTimeString(java.util.Date date) { if (date == null) return ""; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String NDate = formatter.format(date); return NDate; } public static String getTimeString(java.util.Date date, int ss) { if (date == null) return ""; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String NDate = formatter.format(date.getTime() + ss * 60000); return NDate; } public static String format(Date date) { return format(date, "yyyy-MM-dd HH:mm:ss"); } public static String format(Date date, String pattern) { return new SimpleDateFormat(pattern).format(date); } public static long getTime() { return (new java.util.Date()).getTime(); } }