Java Parse Date Pattern YYYY parseToString(Date date, String format)

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

Description

parse To String

License

Open Source License

Declaration

public static String parseToString(Date date, String format) 

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 String parseToString(Date date, String format) {
        if (date == null) {
            return "";
        }/*from ww w  .ja v  a2 s. com*/
        if (format != null) {
            return (new SimpleDateFormat(format)).format(date);
        } else {
            return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
        }
    }
}

Related

  1. parseToDate(String date, String format)
  2. parseToDateLenient(final String date, final String format, final boolean lenient)
  3. parseToGregorianCalendar(String dateString)
  4. parseToRegExcel(String raw)
  5. parseToString(Date date)
  6. parseToString(final Date date, final String format)
  7. parseToStringDate(long ms)
  8. parseTwitterDate(String theDate)
  9. parseUserDate(String date)