Java Long Number to Time getTimeOld(long time)

Here you can find the source of getTimeOld(long time)

Description

get Time Old

License

Apache License

Parameter

Parameter Description
time a parameter

Declaration

public static String getTimeOld(long time) 

Method Source Code

//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));
    }
}

Related

  1. getTime(long time, boolean getTimeOnly, boolean fileSystemSafe)
  2. getTimeFromLong(long diff)
  3. getTimeFromLong(long diff)
  4. getTimeLong()
  5. getTimeOf12(long time)
  6. getTimestampDiff(Long old)
  7. getTimeStr(long t)
  8. getTimeStr(long timeLong)
  9. getTimeString(long nanoTime)