Java String to Date toDateString(final Date date)

Here you can find the source of toDateString(final Date date)

Description

to Date String

License

LGPL

Declaration

public static final String toDateString(final Date date) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String defaultDatePattern = "yyyy-MM-dd HH:mm";

    public static final String toDateString(final Date date, final String pattern) {
        final SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return date == null ? null : sdf.format(date);
    }/* w w  w  .ja v a2s.  co m*/

    public static final String toDateString(final Date date) {
        return toDateString(date, defaultDatePattern);
    }
}

Related

  1. toDateString(Date date, String format)
  2. toDateString(Date date, String format)
  3. toDateString(Date date, String format)
  4. toDateString(Date date, String formatPattern)
  5. toDateString(Date date, TimeZone timezone)
  6. toDateString(java.util.Date date)
  7. toDateString(java.util.Date date)
  8. toDateString(java.util.Date date, String format)
  9. toDateString(java.util.Date date, String spe)