Java Hour Format formatDateTime(Date d)

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

Description

format Date Time

License

Open Source License

Declaration

public static String formatDateTime(Date d) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.*;

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

    public static String formatDateTime(Date d) {
        return formatDateTime(d, DATETIME_PATTERN);
    }/*www .j  a va 2 s . c  om*/

    public static String formatDateTime(Date d, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(d);
    }
}

Related

  1. formatDateTime()
  2. formatDateTime(Calendar cal)
  3. formatDateTime(Calendar dateTime)
  4. formatDateTime(Calendar time)
  5. formatDateTime(Date d)
  6. formatDateTime(Date d)
  7. formatDateTime(Date d)
  8. formatDateTime(Date date)
  9. formatDateTime(Date date)