Java Hour Format formatDateTime(java.util.Date d)

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

Description

format Date Time

License

Open Source License

Declaration

public static final String formatDateTime(java.util.Date d) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

public class Main {
    public static final String formatDateTime(java.util.Date d) {
        // DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
        SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd");
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        return (df.format(d) + " " + sdf.format(d));
    }/* ww w  .jav a  2  s . c o  m*/

    public static final String formatDateTime(java.util.Date d, String format) {
        SimpleDateFormat df = new SimpleDateFormat(format);
        return df.format(d);
    }
}

Related

  1. formatDateTime(Date dateTime)
  2. formatDateTime(Date myDate)
  3. formatDateTime(final Calendar cal)
  4. formatDateTime(final Date dat)
  5. formatDateTime(final Date date)
  6. formatDateTime(java.util.Date date)
  7. formatDateTime(java.util.Date date)
  8. formatDateTime(java.util.Date paramDate)
  9. formatDateTime(String date)