`
Blackbaby
  • 浏览: 185005 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

How to specify firstDayOfWeek for java.util.Calendar using a JVM argument

    博客分类:
  • java
阅读更多

Question:

 

     I'm trying to change default firstDayOfWeek for java.util.Calendar from SUNDAY to MONDAY. Is it possible to achieve this through JVM configuration instead of adding this piece of code?

 

cal.setFirstDayOfWeek(Calendar.MONDAY); 

 

Answer:

   

    The first day of the week is derived from the current locale. If you don't set the locale of the calendar (Calendar.getInstance(Locale), or new GregorianCalendar(Locale)), it will use the system's default. The system's default can be overridden by a JVM parameter:

 

    This should show a different output with different JVM parameters for language/country:

 

-Duser.language=en -Duser.country=US -> en_US: 1 (Sunday)
-Duser.language=en -Duser.country=GB -> en_GB: 2 (Monday)

 

 

分享到:
评论

相关推荐

    A Java architecture test library, to specify and assert ar.zip

    这个名为"A Java architecture test library, to specify and assert ar.zip"的压缩包,包含的是ArchUnit的主要源码和资源文件,其核心部分是`ArchUnit-main`。 ArchUnit库的特性与用法: 1. **定义规则**:...

    java7帮助文档

    Java Virtual Machine Support for Non-Java Languages: Java SE 7 introduces a new JVM instruction that simplifies the implementation of dynamically typed programming languages on the JVM. Garbage-First...

    Java邮件开发Fundamentals of the JavaMail API

    configuring a server to relay messages or to add and remove e-mail accounts. POP POP stands for Post Office Protocol. Currently in version 3, also known as POP3, RFC 1939 defines this protocol. ...

    'FrontEnd Plus' The GUI for the fast JAva Decompiler.

    o decompile a single JAVA class file 'example1.class' type the following: jad example1.class This command creates file 'example1.jad' in the current directory. If such file already exists Jad asks...

    Debugging with GDB --2007年

    2.1.3 Redirecting WDB input and output to a file . . . . . 2.2 Quitting GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Shell commands . . . . . . . . . . . ....

    [Go语言入门(含源码)] The Way to Go (with source code)

    The Way to Go,: A Thorough Introduction to the Go Programming Language 英文书籍,已Cross the wall,从Google获得书中源代码,分享一下。喜欢请购买正版。 目录如下: Contents Preface......................

    The way to go

    1.2 Main characteristics, context and reasons for developing a new language....................4 1.2.1 Languages that influenced Go.......................................................................

    C# to Java 代码转换工具

    Running from the command line: C# to Java Converter can be launched directly for a specific project, folder, or file conversion from the command line. Command line.(命令行执行) 其他一些特点: 1. ...

    Debugging with GDB --2001年5.3

    Contributors to GDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 A Sample GDB Session . . . . . . . . . . . . . . . . . . . . 7 2 Getting In and Out of GDB . ....

    INTRODUCTION TO PYTHON SCRIPTING FOR MAYA ARTISTS.

    To run a Python script from a command prompt, navigate to the directory containing the script using the `cd` command, then execute the script using the `python scriptname.py` command. **Shebang Lines...

    RCF-一个很好的进程间通信库

    RCF is a portable C++ interprocess communication framework, using native C++ features to provide a new and simplified approach to writing distributed C++ software. RCF builds on the time honored ...

    Debugging with GDB --2003年6.0

    Contributors to gdb. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1 A Sample gdb Session . . . . . . . . . . . . . . . . . . . . . . 7 2 Getting In and Out of ...

    Hibernate Reference Documentation3.1

    16.3.1. Using return-property to explicitly specify column/alias names 16.3.2. Using stored procedures for querying 16.3.2.1. Rules/limitations for using stored procedures 16.4. Custom SQL for create,...

    DebuggingWithGDB 6.8-2008

    4.11.1 A Non-obvious Benefit of Using Checkpoints . . . . . . . . . . . . 5 25 26 28 28 29 29 30 31 31 34 36 37 Stopping and Continuing . . . . . . . . . . . . . . . . . . 39 5.1 Breakpoints, ...

    UE(官方下载)

    Create a custom user tool to compile Java code, using the command line, from within UltraEdit Configure UltraEdit with javascript lint How to check your JavaScript source code for common mistakes ...

    Android代码-把 IntelliJ 的自动完成算法填到 Vim 中。

    Make IntelliJ as a Java server that does autocompletion for Vim. This is not an official Google product (i.e. a 20% project). Installation git clone. Import project into IntelliJ. Use Gradle plugin. ...

    最新版的DebuggingWithGDB7.05-2010

    4.12.1 A Non-obvious Benefit of Using Checkpoints . . . . . . . . . . . . . 25 25 28 29 30 30 31 32 32 35 38 40 41 ii 5 Debugging with gdb Stopping and Continuing . . . . . . . . . . . . . . . . . . ....

    TurboPower Async Professional(重新上传)

    We are finally done with release candidates. The components seem to be quite ... This allows you to specify the starting page number for a fax. Thanks to Danny Ambrose for submitting this enhancement.

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Annotation Objects (Enterprise Edition Only) - Annotations allow users of Dundas Chart for .NET to add a wide range of different shapes to the chart without the complexity of custom drawing....

Global site tag (gtag.js) - Google Analytics