Wednesday, July 31, 2019

How do you get the day from Date and Time?

Problem statement:
You are given a date. You just need to write the method, , which returns the day on that date.
For example, if you are given the date August 14th 2017 the method should return MONDAY as the day on that date.
  1. public static String findDay(int mm, int dd, int yy) 
  2. {
  3. java.time.LocalDate dt = java.time.LocalDate.of(yy, mm, dd);
  4. return dt.getDayOfWeek().name();
  5. }
Output: MONDAY

No comments:

Post a Comment

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...