ZonedDateTime toString() example
Description
ZonedDateTime toString()
outputs
this date-time as a String, such
as 2014-12-03T10:15:30+01:00[Europe/Paris].
Syntax
toString
has the following syntax.
public String toString()
Example
The following example shows how to use toString
.
import java.time.ZonedDateTime;
/* w w w. ja va2s . c o m*/
public class Main {
public static void main(String[] args) {
ZonedDateTime dateTime =ZonedDateTime.now();
System.out.println(dateTime.toString());
}
}
The code above generates the following result.