Code example for SimpleDateFormat

Methods: format

0
    	 
	} 
	 
	public static String formatUnixtime(long time) {
		 
		Format formatter = new SimpleDateFormat("M/d/yyyy, h:mma");
		Date expiry = new Date(time);
		 
		String out = formatter.format(expiry);
		return out.toLowerCase();
		 
	} 
	 
    public static String getTimeAgo(long time) {
    	 
    	long now = (new Date()).getTime();
    	 
    	long diff = (now - time) / 1000;
    	 
    	if (diff < 60) {
    		return pluralize(diff, "second");