Java Long Number to Date formatDateTime(long d)

Here you can find the source of formatDateTime(long d)

Description

Convert date and time to string like "yyyy-MM-dd HH:mm".

License

Apache License

Declaration

public static String formatDateTime(long d) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String DATETIME_FORMAT = "yyyy-MM-dd HH:mm";

    /**// w w  w.  jav a 2 s.c o  m
     * Convert date and time to string like "yyyy-MM-dd HH:mm".
     */
    public static String formatDateTime(Date d) {
        return new SimpleDateFormat(DATETIME_FORMAT).format(d);
    }

    /**
     * Convert date and time to string like "yyyy-MM-dd HH:mm".
     */
    public static String formatDateTime(long d) {
        return new SimpleDateFormat(DATETIME_FORMAT).format(d);
    }
}

Related

  1. formatDateHeader(final long date)
  2. formatDateHeader(long millis)
  3. formatDateHeader(long value)
  4. formatDateISO(long millis)
  5. formatDateTime(long d)
  6. formatDateTime(long date)
  7. formatDateTime(long millis)
  8. formatDateTime(long time)
  9. formatDateTime(long timestampEpoch)