Java Millisecond Convert millisToDateString(Long Millis)

Here you can find the source of millisToDateString(Long Millis)

Description

millis To Date String

License

Open Source License

Declaration

public static String millisToDateString(Long Millis) 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static final String datetimeFormat = "yyyy-MM-dd HH:mm:ss";

    public static String millisToDateString(Long Millis) {
        Date date = millisToDate(Millis);
        return getFormat(datetimeFormat).format(date);

    }//from w ww .  j  a  va 2  s .  c  o  m

    public static Date millisToDate(Long Millis) {
        Calendar cad = Calendar.getInstance();
        cad.setTimeInMillis(Millis);
        return cad.getTime();
    }

    public static final String format(Date date, String formate) {
        if (date == null) {
            return "";
        }
        return getFormat(formate).format(date);
    }

    public static final String format(Long dateTmie, String formate) {
        Date date = new Date(dateTmie);
        return getFormat(formate).format(date);
    }

    public static final DateFormat getFormat(String format) {
        return new SimpleDateFormat(format);
    }
}

Related

  1. millisecsToSecs(long millisecs)
  2. milliSecsToTime(double current, double max, double buffer)
  3. milliSecToString(final long mS)
  4. milliSecToTime(double millis)
  5. millisToCycles(double millis, double hz)
  6. millisToDays(long millis)
  7. millisToDuration(long millis)
  8. millisToDurationString(long millis)
  9. millisToHMS(long millis)