Java Long Number to Date formatDate(long millis, String dateFormat)

Here you can find the source of formatDate(long millis, String dateFormat)

Description

format Date

License

Open Source License

Declaration

public static String formatDate(long millis, String dateFormat) 

Method Source Code


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

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String formatDate(long millis, String dateFormat) {
        SimpleDateFormat sdf = new SimpleDateFormat();
        if (dateFormat == null) {
            throw new NullPointerException("Date format cannot be null. Please provide valid date format.");
        }//from   w w  w .j  a  v  a2  s  .c o m
        sdf.applyPattern(dateFormat);
        return sdf.format(new Date(millis));
    }
}

Related

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