Java String to Date LongToDateString(long l)

Here you can find the source of LongToDateString(long l)

Description

Long To Date String

License

Apache License

Declaration

public static String LongToDateString(long l) 

Method Source Code


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

import java.text.DateFormat;

import java.util.Date;

public class Main {

    public static String LongToDateString(long l) {
        DateFormat mediumDateFormat;
        Date sDate;//from www .j av a  2s. com
        try {
            mediumDateFormat = DateFormat.getDateTimeInstance();
            String date = String.valueOf(l);
            sDate = new Date(Long.parseLong(date));
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
        return mediumDateFormat.format(sDate);
    }
}

Related

  1. getStringToDate(String str)
  2. getStringToDateFull(String da)
  3. getStringToDateTime(String dateStr, String formatStr)
  4. getTodateString()
  5. humanDateToDate(String date)
  6. longToDateString(long l)
  7. longToDateStringDefault(long time)
  8. numberToDate(String dateString)
  9. putTimeStr14ToDate(String dateTimeStr)