問題描述
我們使用一個 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 應用程序日歷中設置一周的第一天的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!