Retrieve the first day of week in current locale (what day of the week is it today?)

Some places(country) start the week with Sunday, some with Monday, maybe some with others, IDK, some this magic let java library find the right one for us. Calculate the day of the week at the beginning of the local week (Monday, Sunday, and more)

DayOfWeek firstDayOfWeek = WeekFields.of(locale).getFirstDayOfWeek();
LocalDate firstDay = today.with(TemporalAdjusters.previousOrSame(firstDayOfWeek));

*only serve as memo so actual syntax may break

Recommended Posts

Retrieve the first day of week in current locale (what day of the week is it today?)
Change the conversation depending on which day of the week is today
What is the representation of domain knowledge in the [DDD] model?
'% 02d' What is the percentage of% 2?
What is it? ~ 3 types of "no" ~
What is @Override or @SuppressWarnings ("SleepWhileInLoop") in front of the function? ?? ??
What is testing? ・ About the importance of testing
[Java] Get the day of the specific day of the week
What is the main method in Java?
What is the data structure of ActionText?
[Beginner] What is Docker in the first place? Easy-to-understand explanation from the basics!
[Java] Is it unnecessary to check "identity" in the implementation of the equals () method?
Is it mainstream not to write the closing tag of <P> tag in Javadoc?
[Java] Calculate the day of the week from the date (Calendar class is not used)
What is Pullback doing in The Composable Architecture
What is JSP? ~ Let's know the basics of JSP !! ~
The story of learning Java in the first programming
How to get today's day of the week
[Ruby] Code to display the day of the week
Get the value from the array and find out what number it is included in
(First day) java.io.InputStream is a resort casino white clothing dealer (in charge of cards)
First AWS Lambda (I tried to see what kind of environment it works in)
[Java] How to display the day of the week acquired by LocalDate, DateTimeformatter in Japanese
[Ubuntu 20.04] Display the day of the week on the date / clock
In Time.strptime,% j (total date of the year) is
What is the difference between the responsibilities of the domain layer and the application layer in the onion architecture [DDD]
Even if I write the setting of STRICT_QUOTE_ESCAPING in CATALINA_OPTS in tomcat8.5, it is not reflected.
[Ruby] Thinking when there is no receiver in front of the method (it looks like)
Was done in the base year of the Java calendar week
Transition using the header image of CardView as it is
Determine that the value is a multiple of 〇 in Ruby
[Ruby] Display today's day of the week using Date class
How to derive the last day of the month in Java
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
The behavior of Class # getClassLoader changes depending on whether it is executed in the IDE or jar.