Java Date Format dateFormat(Date date)

Here you can find the source of dateFormat(Date date)

Description

date Format

License

Apache License

Declaration

public static String dateFormat(Date date) 

Method Source Code


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

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String dateFormat(Date date) {
        if (date != null) {
            DateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            return sf.format(date);
        } else {//from w  w  w .  j  av a2  s.  c  om
            return "";
        }

    }

    public static String dateFormat(Date date, String style) {
        if (date != null) {
            DateFormat sf = new SimpleDateFormat(style);
            return sf.format(date);
        } else {
            return "";
        }
    }
}

Related

  1. convertDateToXSDString(Date date)
  2. convertDayToString(Date aDate)
  3. dateFmtToString(Date date, SimpleDateFormat fmt)
  4. dateFormat(Date d, String formatStr)
  5. dateFormat(Date date)
  6. dateFormat(Date date)
  7. dateFormat(Date date)
  8. dateFormat(Date date)
  9. dateFormat(Date date, String format)