Java Date to String dateToString(Date date)

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

Description

Convert a date object to string.

License

Open Source License

Parameter

Parameter Description
date the date to convert.

Return

the string representation.

Declaration

public static String dateToString(Date date) 

Method Source Code

//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /** Represents the data format. */
    private static final String DATE_FORMAT = "MM.dd.yyyy h:mm a";

    /**//from   w  w  w .  j a va 2s .  co  m
     * Convert a date object to string.
     *
     * @param date the date to convert.
     *
     * @return the string representation.
     */
    public static String dateToString(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT);

        return formatter.format(date);
    }
}

Related

  1. dateToString(Date date)
  2. DateToString(Date date)
  3. dateToString(Date date)
  4. DateToString(Date date)
  5. dateToString(Date date)
  6. dateToString(Date date)
  7. dateToString(Date date)
  8. dateToString(Date date)
  9. dateToString(Date date)