Java Millisecond Format formatTime(long localCreationTimeMillis)

Here you can find the source of formatTime(long localCreationTimeMillis)

Description

format Time

License

Apache License

Declaration

public static String formatTime(long localCreationTimeMillis) 

Method Source Code

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

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

public class Main {
    private static DateFormat m_dateFormatWithMillis = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss.SSS");
    private static ThreadLocal<Date> m_dates = new ThreadLocal<Date>();

    public static String formatTime(long localCreationTimeMillis) {
        Date date = getTempDate();
        date.setTime(localCreationTimeMillis);
        return m_dateFormatWithMillis.format(date);
    }/* ww w.  j  a  v  a  2 s .  co m*/

    private static Date getTempDate() {
        Date date = m_dates.get();
        if (date == null) {
            date = new Date();
            m_dates.set(date);
        }
        return date;
    }
}

Related

  1. formatMillisTime(long millis)
  2. formatMillisTimeGMT(long millis)
  3. formatSystemTime(long millis)
  4. formattedMillis(long millis)
  5. formatTime(long currentTimeMillis)
  6. formatTime(long millis)
  7. formatTime(long millis)
  8. formatTimeInMillis(long millis)
  9. formatTimeMillis(long millis)