Java Date Create toDateFromLong(Long time)

Here you can find the source of toDateFromLong(Long time)

Description

to Date From Long

License

Open Source License

Declaration

public static Date toDateFromLong(Long time) 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Date toDateFromLong(Long time) {
        try {//w w w.j  a  v a2  s.c om
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String str = formatter.format(time);
            Date date = formatter.parse(str);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. toDate(Object o)
  2. ToDate(Object o)
  3. toDate(Object object)
  4. toDate(Object value)
  5. toDateFormat(Date date)
  6. toDateHeader(long value)
  7. toDateList(Collection list)
  8. toDateQueryFormat(Date value)
  9. toDateStr(Date d)