How to set first day of week in a Java application calendar(如何在 Java 应用程序日历中设置一周的第一天)
问题描述
我们使用一个 java 应用程序,它有一个日期选择字段,当您单击该字段时,会打开一个小日历.一周的第一天是星期天.但我希望它是星期一.我尝试从日期设置中的 Windows 控制面板更改它.例如,我将 Windows 日历的第一天设置为星期四.但是在 Java 应用程序的日历中,一周的第一天仍然是星期日.是否可以从 Windows 更改 Java 应用程序的一周的第一天,还是仅从 Java 应用程序的代码更改?
We use a java application, it has a date selection field, when you click there a small calendar opens. First day of the week is Sunday there. But I want it to be Monday. I try to change it from Windows Control Panel from Date settings. I set Windows calendar's first day to Thursday, for instance. But in Java application's calendar, first day of the week is still Sunday. Is it possible to change the Java application's first day of the week from Windows, or is it only changed from Java application's code?
问候
推荐答案
您的 java 应用使用哪个框架?日期选择字段是什么组件?
Which framework does your java app use? What kind of component is the date selection field?
在 Java 的 Calendar
中,默认情况下一周的第一天由系统的区域设置决定.
In Java's Calendar
the first day of week by default is determined by the Locale setting of your system.
因此,如果您无法更改应用程序的源代码:
So if you cannot change the source code of your application:
- 您可能想要更改操作系统的区域设置(在您的情况下为 Windows)
- 或者您可以在启动 jvm 时使用各种命令行参数,例如
-Duser.country
或-Duser.region for
java.看看这里.
- you might want to change the locale of your operating system (in your case Windows)
- or you might use various command line arguments like
-Duser.country
or-Duser.region for
java when firing up your jvm. Have a look here.
这篇关于如何在 Java 应用程序日历中设置一周的第一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 Java 应用程序日历中设置一周的第一天


- Eclipse 的最佳 XML 编辑器 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 获取数字的最后一位 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01