Here you can find the source of getTime(long time, boolean getTimeOnly, boolean fileSystemSafe)
Parameter | Description |
---|---|
time | The time to convert |
getTimeOnly | Whether or not the result should exclude the date |
fileSystemSafe | Whether or not the date should be file system safe(does nothing if the date is excluded) |
public static String getTime(long time, boolean getTimeOnly, boolean fileSystemSafe)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** @param time The time to convert * @param getTimeOnly Whether or not the result should exclude the date * @return The result *//*from ww w . ja v a 2 s . c o m*/ public static String getTime(long time, boolean getTimeOnly) { return getTime(time, getTimeOnly, false); } /** @param time The time to convert * @param getTimeOnly Whether or not the result should exclude the date * @param fileSystemSafe Whether or not the date should be file system * safe(does nothing if the date is excluded) * @return The result */ public static String getTime(long time, boolean getTimeOnly, boolean fileSystemSafe) { return new SimpleDateFormat( getTimeOnly ? "HH-mm-ss" : fileSystemSafe ? "MM-dd-yyyy_HH.mm.ss" : "MM/dd/yyyy'\t'h:mm:ss a") .format(new Date(time)); } }