問題描述
我需要獲取某個區(qū)域/國家/地區(qū)的一周的第一天.
I need to get the first day of week for a certain Locale / Country.
我嘗試使用以下代碼找到它:
I tried to find it using this code:
這段代碼的結(jié)果是,所有這些語言環(huán)境都在檢索1",即星期日,而諸如 en_US
之類的語言環(huán)境應(yīng)該返回 2,即星期一.
The result of this code is that all of these locales are retrieving '1' which is Sunday, and locales such en_US
should return 2 which is Monday.
推薦答案
傳入兩個參數(shù) - language &國家/地區(qū),分開 - 而不是你的帶下劃線的字符串.請參閱 Oracle 教程.
Pass in two arguments –?language & country, separately – rather than your string with underscore. See Oracle Tutorial.
然后我會使用 Java8 來獲取一周的第一天:
And then I would use Java8 to get the first day of the week:
輸出:
星期一
星期一
星期天
星期一
星期一
星期天
星期天
這篇關(guān)于如何獲得某個地區(qū)/國家/地區(qū)的第一天的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!