Java Date to String dateToString(Date date)

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

Description

date To String

License

Apache License

Declaration

public static String dateToString(Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;

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

public class Main {
    public static String dateToString(Date date) {
        DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");

        // Get the date today using Calendar object.
        Date today = Calendar.getInstance().getTime();

        // Using DateFormat format method we can create a string
        // representation of a date with the defined format.
        String reportDate = df.format(today);
        return reportDate;

    }//  w  w w. ja  v a  2  s  . co  m
}

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, String dateFormat)
  9. dateToString(Date date, String formartStr)