Here you can find the source of toHumanTime(long timestamp, String format)
Parameter | Description |
---|---|
timestamp | a parameter |
format | a parameter |
public static String toHumanTime(long timestamp, String format)
//package com.java2s; /**/*from w w w. j a v a 2s .c o m*/ * * @author Shinmera * @license GPLv3 * @version 0.0.0 */ import java.text.SimpleDateFormat; public class Main { public static final SimpleDateFormat defaultSDF = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); /** * Returns a string representation of the timestamp. * @param timestamp * @return * @see StringUtils#toHumanTime(long, java.lang.String) */ public static String toHumanTime(long timestamp) { return toHumanTime(timestamp, null); } /** * Returns a string representation of the timestamp using the specified * format. The format has to conform to the SimpleDateFormat formatting * rules. If the format is set to null, a default time format of * yyyy.MM.dd HH:mm:ss is used. * @param timestamp * @param format * @return * @see SimpleDateFormat#SimpleDateFormat(java.lang.String) */ public static String toHumanTime(long timestamp, String format) { return (format == null) ? defaultSDF.format(timestamp) : new SimpleDateFormat(format).format(timestamp); } }