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

查看:881
本文介绍了如何在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的日历中,默认情况下,一周的第一天由系统的Locale设置决定。

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)

  • 或者您可以使用各种命令行参数,例如 -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天全站免登陆