Here you can find the source of getTimeOld(long time)
Parameter | Description |
---|---|
time | a parameter |
public static String getTimeOld(long time)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**/*w w w .j a va2s . c o m*/ * * @param time * @return */ public static String getTimeOld(long time) { String str1 = ""; String str2 = ""; SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd"); Date date = new Date(time); str2 = format.format(date); Date newDate2 = new Date(date.getTime() - 7 * 24 * 60 * 60 * 1000); str1 = format.format(newDate2); return str1 + "~" + str2; } public static String getTime(long time) { SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm"); return format.format(new Date(time)); } }