Java Long Number to Date formatDate(long millisecond, String format)

Here you can find the source of formatDate(long millisecond, String format)

Description

format Date

License

Open Source License

Parameter

Parameter Description
millisecond a parameter
format a parameter

Return

String

Declaration

public static String formatDate(long millisecond, String format) 

Method Source Code


//package com.java2s;
import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**/*from  w w w  .  j  a  v  a 2s.  c o  m*/
     * @param date
     * @param format
     * @return String
     */
    public static String formatDate(Date date, String format) {
        DateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(date);
    }

    /**
     * @param millisecond
     * @param format
     * @return String
     */
    public static String formatDate(long millisecond, String format) {
        DateFormat dateFormat = new SimpleDateFormat(format);
        Date date = new Date(millisecond);
        return dateFormat.format(date);
    }
}

Related

  1. formatDate(long millis)
  2. formatDate(long millis)
  3. formatDate(long millis)
  4. formatDate(long millis, Locale locale)
  5. formatDate(long millis, String dateFormat)
  6. formatDate(long ms)
  7. formatDate(long ms)
  8. formatDate(long p_millis)
  9. formatDate(long t)