Converts this Date object to a String of the form
dow mon dd hh:mm:ss zzz yyyy
public String toString()
None.
A string representation of this date.
Following is an example of the usage of this method −
class Example { static void main(String[] args) { Date olddate = new Date("05/11/2015"); Date newdate = new Date("05/11/2015"); Date latestdate = new Date(); System.out.println(olddate.toString()); System.out.println(newdate.toString()); System.out.println(latestdate.toString()); } }
When we run the above program, we will get the following result −
Mon May 11 00:00:00 GST 2015 Mon May 11 00:00:00 GST 2015 Thu Dec 10 21:46:18 GST 2015