Java Hour Format format16ByDate(Date aDate)

Here you can find the source of format16ByDate(Date aDate)

Description

format By Date

License

Open Source License

Declaration

public static String format16ByDate(Date aDate) 

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 final String _16DIGIT_DATE_TIME = "yyyy/MM/dd-HH:mm:ss";

    public static String format16ByDate(Date aDate) {
        SimpleDateFormat sdf = new SimpleDateFormat(_16DIGIT_DATE_TIME);

        return sdf.format(aDate);
    }/* ww w  . j  a va 2s.  co  m*/

    public static String format(Date aDate, String type) {
        SimpleDateFormat sdf = new SimpleDateFormat(type);

        return sdf.format(aDate);
    }

    public static String format(Long dateMs, String type) {
        Date date = new Date(dateMs);
        SimpleDateFormat sdf = new SimpleDateFormat(type);
        return sdf.format(date);
    }
}

Related

  1. format(long time)
  2. format(Number price)
  3. format(String format, Date val)
  4. format(String pattern)
  5. format(String str)
  6. format1StringToformat2String(String dateStr)
  7. format2NormalTime(Date date)
  8. format_default(Date time)
  9. formatAbsoluteTime(long time)