Java Long Number to Date formatDate(long date)

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

Description

Returns a formatted date.
The pattern is: yyyy-MM-dd,HH:mm:ss

License

Open Source License

Parameter

Parameter Description
date The date

Return

The formatted date

Declaration

public static String formatDate(long date) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    /**/*from www  . j  a v a 2  s  .  com*/
     * Returns a formatted date.<br>
     * The pattern is: yyyy-MM-dd,HH:mm:ss
     *
     * @param date
     *            The date
     * @return The formatted date
     */
    public static String formatDate(long date) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd,HH:mm:ss");
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(date * 1000);
        return format.format(cal.getTime());
    }
}

Related

  1. formatDate(long d)
  2. formatDate(long d)
  3. formatDate(long date)
  4. formatDate(Long date)
  5. formatDate(long date)
  6. formatDate(long date)
  7. formatDate(long date)
  8. formatDate(long date)
  9. formatDate(long date)