如何在 Java 应用程序日历中设置一周的第一天 [英] How to set first day of week in a Java application calendar

查看:36
本文介绍了如何在 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 应用程序日历中设置一周的第一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆