Java Date to String dateToStr(Date date, String format)

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

Description

date To Str

License

Open Source License

Parameter

Parameter Description
date a parameter
format a parameter

Declaration

public static String dateToStr(Date date, String format) 

Method Source Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String dateToStr(Date date) {
        return dateToStr(date, "yyyy-MM-dd");
    }//from   w  ww  .j a v a2 s  .  com

    public static String dateToStr(Date date, String format) {
        return new SimpleDateFormat(format).format(date);
    }
}

Related

  1. dateToStr(Date date)
  2. dateToStr(Date date)
  3. dateToStr(Date date)
  4. dateToStr(Date date, int type)
  5. dateToStr(Date date, String format)
  6. dateToStr(Date date, String formatstr)
  7. dateToStr(Date date, String formatType)
  8. dateToStr(Date source)
  9. datetoStr2(Date date)