We would like to know how to format date time in form of 'June 22, 2015 (In Time Zone: America/Los_Angeles)'.
import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; //from ww w. ja v a 2 s .com public class Main { public static void main(String[] args) { DateTimeFormatter obscurePattern = DateTimeFormatter.ofPattern("MMMM dd, yyyy '(In Time Zone: 'VV')'"); ZonedDateTime zonedNow = ZonedDateTime.now(); System.out.println(obscurePattern.format(zonedNow)); } }
The code above generates the following result.