Java Timestamp Format toReadableTime(Long timestamp, String format)

Here you can find the source of toReadableTime(Long timestamp, String format)

Description

to Readable Time

License

Apache License

Declaration

public static String toReadableTime(Long timestamp, String format) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.TimeZone;

public class Main {
    public static String toReadableTime(Long timestamp, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setTimeZone(TimeZone.getDefault());
        if (timestamp == null)
            timestamp = System.currentTimeMillis();
        return sdf.format(new Date(timestamp));
    }/*from w w w.  j a v  a 2  s  .com*/
}

Related

  1. timestampToString(final Date ts, final String format, final String tzId)
  2. timestampToString(Long timestamp, String formatStr)
  3. timeToString(long timestamp, SimpleDateFormat format)
  4. toDateFromTimestamp(String timestamp, String format)
  5. toHumanTime(long timestamp, String format)
  6. toTimeStamp(String dateTime, SimpleDateFormat format, int timeZoneOffset)
  7. unixTimestamp(String date, String dateFormat)