How to determine day of week by passing specific date?

前端 未结 25 1876
夕颜
夕颜 2020-11-22 05:12

For Example I have the date: \"23/2/2010\" (23th Feb 2010). I want to pass it to a function which would return the day of week. How can I do this?

I

25条回答
  •  一个人的身影
    2020-11-22 05:52

    There is a challenge on hackerrank Java Date and Time

    personally, I prefer the LocalDate class.

    1. Import java.time.LocalDate
    2. Retrieve localDate by using "of" method which takes 3 arguments in "int" format.
    3. finally, get the name of that day using "getDayOfWeek" method.

    There is one video on this challenge.

    Java Date and Time Hackerrank solution

    I hope it will help :)

提交回复
热议问题