Java Long Number to Date formatDate(Long date)

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

Description

Formats a date.

License

Open Source License

Parameter

Parameter Description
date the date in the form of a UNIX timestamp

Return

formatted date

Declaration

public static String formatDate(Long date) 

Method Source Code


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

import java.text.DateFormat;
import java.util.Date;

public class Main {
    /**/*w  w  w .  j a va 2  s  .c  om*/
     * Formats a date.
     * @param date the date in the form of a UNIX timestamp
     * @return formatted date
     */
    public static String formatDate(Long date) {
        if (date == null) {
            return null;
        }

        return formatDate(new Date(date));
    }

    /**
     * Formats a date.
     * @param date the date
     * @return formatted date
     */
    public static String formatDate(Date date) {
        if (date == null) {
            return null;
        }

        return DateFormat.getDateTimeInstance().format(date);
    }
}

Related

  1. formatDate(long date)
  2. formatDate(long date)
  3. formatDate(long date)
  4. formatDate(long date)
  5. formatDate(long date)
  6. formatDate(Long date, String fmt)
  7. formatDate(long date, String format)
  8. formatDate(long date, String langStr)
  9. formatDate(long dateValue)