Java Date Parse convertTimestampToDateTime(Long timestamp, Boolean withSeconds)

Here you can find the source of convertTimestampToDateTime(Long timestamp, Boolean withSeconds)

Description

convert Timestamp To Date Time

License

Open Source License

Declaration

public static String convertTimestampToDateTime(Long timestamp, Boolean withSeconds) 

Method Source Code

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

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

public class Main {
    public static String convertTimestampToDateTime(Long timestamp, Boolean withSeconds) {
        String result = null;//from ww w.  ja  v  a  2 s  .  c  om
        SimpleDateFormat sdf;
        if (withSeconds) {
            sdf = new SimpleDateFormat("MM/dd/yyyy(HH:mm:ss.SSS)");
        } else {
            sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
        }
        Date resultdate = new Date(timestamp);
        result = sdf.format(resultdate);
        return result;
    }
}

Related

  1. convertStrToDate(String s, String format)
  2. convertStrToDate(String source)
  3. convertTFormatToCDATime(String tDate)
  4. convertTimeInMillisecondsToDate(long timeInMilliseconds)
  5. convertTimeStampToDate(String dateString, String srcFormat, String destFormat)
  6. convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime)
  7. convertUTCDateToLocal(String sDate, TimeZone timezone)
  8. convertXMLDate(String date)
  9. dateFromFilename(File file, Pattern fileNamePattern, DateFormat dateFormat)