Java program to print ZonedDateTime

0 0
Read Time:24 Second

Write a Java program to print ZonedDateTime E MMM yyyy HH:mm:ss.SSSZ

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
class Zoned_DateTime
{
	public static void main(String Args[])
	{
		String dt;
		ZonedDateTime zdt = ZonedDateTime.now();
		DateTimeFormatter formatterZonedDateTime = DateTimeFormatter.ofPattern("E MMM yyyy HH:mm:ss.SSSZ");
		dt = formatterZonedDateTime.format(zdt);
		System.out.println("E MMM yyyy HH:mm:ss.SSSZ = " + dt);
	}
}

Output:

E MMM yyyy HH:mm:ss.SSSZ = Tue Jan 2022 09:05:28.940+0530
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %