Java Time to String toString(Date time)

Here you can find the source of toString(Date time)

Description

to String

License

Open Source License

Declaration

public static String toString(Date time) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String toString(Date time) {
        return getDateString(time, "yyyy-MM-dd HH:mm:ss");
    }//from w  ww  . j  av a  2  s. c  o m

    public static String getDateString(Date date, String dateFormat) {
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        return sdf.format(date);
    }
}

Related

  1. timeToString(long time)
  2. timeToString(long time)
  3. timeToString(long time)
  4. toString(Calendar modifiedTime, String pattern)
  5. toString(Date d, boolean includeTime)
  6. toString(long time)