Java Long Number to Date convertDate(long millisecs)

Here you can find the source of convertDate(long millisecs)

Description

Converts the time from milliseconds to human-readable format

License

Open Source License

Parameter

Parameter Description
millisecs Current system time in milliseconds

Return

Human-readable time in "yyyyMMdd_kkmm_ss" format

Declaration

public static String convertDate(long millisecs) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static final String flameDateFormat = "yyyyMMdd_HHmm_ss";

    /**/*  ww  w . j  a  v a 2 s  .c om*/
     * Converts the time from milliseconds to human-readable format
     * @param millisecs         Current system time in milliseconds
     * @return               Human-readable time in "yyyyMMdd_kkmm_ss" format
     */
    public static String convertDate(long millisecs) {
        SimpleDateFormat date_format = new SimpleDateFormat(flameDateFormat);

        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(millisecs);

        return date_format.format(c.getTime());
    }
}

Related

  1. convert(long time)
  2. convert(long value, double[] factors, String[] unites)
  3. convert(Long[] targets)
  4. convert2long(String date, String format)
  5. convertDate(long datenum)
  6. convertDate(long timestamp)
  7. convertDate(Long uTime, SimpleDateFormat dateFormat)
  8. convertDateFromLong(Long val)
  9. convertDateFromTimeStamp(long timeStamp, String dateFormat)