Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道这必须在某个地方,但是 GregorianCalendar 类如何确定哪一天是一周的第一天?它是由 Locale 执行的,还是保持静态?
我最终要做的是测试以确定是否是美国的周末。任何指针?
GregorianCalendar 由 Locale 确定。
你可以做类似的事情。
GregorianCalendar cal = new GregorianCalendar(someTimezone, Locale.US); int day = cal.get(Calendar.DAY_OF_WEEK); if (day == Calendar.SATURDAY || day == Calendar.SUNDAY) { // do something interesting }