Java Long Number to Date formatDate(long ms)

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

Description

format Date

License

Open Source License

Declaration

public static synchronized String formatDate(long ms) 

Method Source Code

//package com.java2s;
/*/*  ww  w  . j  a  va 2 s . c o  m*/
 * Copyright (C) ${year} Omry Yadan <${email}>
 * All rights reserved.
 *
 * See https://github.com/omry/banana/blob/master/BSD-LICENSE for licensing information
 */

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    static SimpleDateFormat s_df;

    public static synchronized String formatDate(long ms) {
        return formatDate(new Date(ms));
    }

    public static synchronized String formatDate(Date d) {
        if (s_df == null)
            s_df = new SimpleDateFormat("dd MMM yyyy HH:mm:ss zzz");

        return s_df.format(d);
    }
}

Related

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