如何在人类的特定时区以特定区域设置即时格式

问题描述 投票:0回答:1

我正在使用:

Locale locale = Locale.FRENCH;
DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.FULL).withLocale(locale).withZone(zone);
System.out.println(formatter.format(Instant.now()));

我得到的结果是带有lundi 25 mai 2020 20 h 21 CESTLocale.FRENCH和带有Monday, May 25, 2020 8:05:11 PM CESTLocale.English

我发现CEST对非IT人员不友好,如何可靠地将其删除?

java java-8 datetime-format
1个回答
0
投票

您可以自定义要显示的内容和不显示的内容例如DateTimeFormatter.ofPattern("EEEE, MMMM dd, yyyy hh:mm:ss a")给出lundi, mai 25, 2020 07:02:57 PM

© www.soinside.com 2019 - 2024. All rights reserved.