Java Locale Format format(Date date)

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

Description

format

License

Apache License

Declaration

public static String format(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 format(Date date, String format) {
        String result = "";
        try {//w  w w  .j a  v  a2  s  .c o m
            if (date != null) {
                DateFormat dateFormat = new SimpleDateFormat(format);
                result = dateFormat.format(date);
            }
        } catch (Exception localException) {
        }
        return result;
    }

    public static String format(Date date) {
        return format(date, "yyyy-MM-dd");
    }
}

Related

  1. format(BigInteger amount)
  2. format(Date d, Locale locale)
  3. format(Date d, String format)
  4. format(Date date)
  5. format(Date date, String format)
  6. format(Date date, String format, Locale locale)
  7. format(Date date, String parttern)