Java Date to String convertToString(Date date)

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

Description

convert To String

License

Open Source License

Declaration

public static String convertToString(Date date) 

Method Source Code


//package com.java2s;
import java.text.*;
import java.util.*;

public class Main {
    public static String convertToString(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        try {/*from w w  w.  j av a 2 s  .  c  o  m*/
            return formatter.format(date);
        } catch (Exception e) {
            // e.printStackTrace();
            return null;
        }
    }
}

Related

  1. convertDateToString(String dateFormat, Date date)
  2. convertDateToString(String mask, Date date)
  3. convertDateToURLFormat(final String dateToBeConvert)
  4. convertStringoXSDString(Date date)
  5. convertTimeToString(Date date, String pattern)
  6. ConvertToString(Date date, String format)
  7. convertToString(Date date, String style)
  8. convertToString(java.util.Date date)
  9. convertToString(String format, Date date)