Java Long Number to Date dateToString(long date, String formate)

Here you can find the source of dateToString(long date, String formate)

Description

date To String

License

Apache License

Declaration

public static String dateToString(long date, String formate) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String dateToString(long date, String formate) {
        return dateToString(new Date(date), formate);
    }//w  w  w  .jav a 2s . c  o  m

    public static String dateToString(Date date, String formate) {
        if (date == null) {
            return "";
        }
        formate = (formate == null) ? "yyyy-MM-dd HH:mm:ss.SSS" : formate;
        return new SimpleDateFormat(formate).format(date);
    }

    public static String dateToString(Date date) {
        return dateToString(date, "yyyy-MM-dd HH:mm:ss");
    }

    public static String dateToString(long date) {
        return dateToString(new Date(date));
    }
}

Related

  1. dateToPGNDate(long when)
  2. dateToString(long date)
  3. dateToString(long date)
  4. dateToString(long date)
  5. dateToString(long date)
  6. dateToStrLong(java.util.Date dateDate, String format)
  7. format(long date)
  8. format(Long date, String pattern)
  9. format(long date, String pattern)