Java Parse Long parseLongtoTime(long date)

Here you can find the source of parseLongtoTime(long date)

Description

parse Longto Time

License

Open Source License

Declaration

public static String parseLongtoTime(long date) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    private static DateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String parseLongtoTime(long date) {
        return dateFormat2.format(new Date(date));
    }/* w w  w.  ja v a 2s  . c o  m*/

    public static String format(long l, String format) {
        Date d = getDate(l);
        SimpleDateFormat bartDateFormat = new SimpleDateFormat(format);
        String datearr = bartDateFormat.format(d);

        return datearr;
    }

    public static Date getDate() {
        return Calendar.getInstance().getTime();
    }

    public static Date getDate(long l) {
        return new Date(l);
    }

    public static Date getDate(Date date, long lauchtime) {
        return new Date(date.getTime() + lauchtime);
    }

    public static long getTime() {
        return Calendar.getInstance().getTimeInMillis();
    }
}

Related

  1. parseLong(final String s, final String fmt)
  2. parseLong(String d)