Java Milliseconds longToDate(long millis)

Here you can find the source of longToDate(long millis)

Description

Turns a long variable that represents time into a String

License

Open Source License

Parameter

Parameter Description
millis a parameter

Declaration

public static String longToDate(long millis) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

public class Main {
    /**//  w w  w  . java2  s  .c o  m
     * Turns a long variable that represents time into a String
     * @param millis
     * @return 
     */
    public static String longToDate(long millis) {
        Date date = new Date(millis);
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US);
        dateFormat.setTimeZone(TimeZone.getDefault().getTimeZone("GMT"));
        return dateFormat.format(date);
    }
}

Related

  1. getUnitLengthMillis(String unit)
  2. hasExpiredMillis(long now, long eventTime, long timeBuffer)
  3. hhmmssToMillis(String text)
  4. humanDateToMillisecondsWithoutException(String date)
  5. isSameSecondOfMillis(final long ms1, final long ms2)
  6. marsTimeFromElapsedMillis(long elapsedMillis, int[] marsTime)
  7. megaCyclesToMilliseconds(long megaCycles)
  8. microsToMillis(long micros)
  9. microsToMillis(long sec, long usec)