0

I receive from UI selected date, not now Date, it's may be different date.
I need to check weekend and add local non-working days and check these days too. I receive:

   @RequestParam(value = "valueDate")
   @DateTimeFormat(pattern = "yyyy-MM-dd")Date valueDate

I can use valueDate.getDay(), but how I understand this old format (because getDay() is crossed out).
How will now?

Viking
  • 177
  • 5
  • 16
  • Possible duplicate of [I want to get Year, Month, Day, etc from Java Date to compare with Gregorian Calendar date in Java. Is this possible?](https://stackoverflow.com/questions/9474121/i-want-to-get-year-month-day-etc-from-java-date-to-compare-with-gregorian-cal) – OldCurmudgeon Aug 23 '17 at 08:38
  • java.util.Date API is old and ugly, and most it's methods are deprecated now. Use java.time API – Ivan Zelenskyy Aug 23 '17 at 08:48

1 Answers1

2

Examining Dates for features such as day of week etc. is discouraged due to significant issues with edge cases such as time zones etc.

It is recommended that you examine Dates using a Calendar object, or, for Java 8, the Time API.

See I want to get Year, Month, Day, etc from Java Date to compare with Gregorian Calendar date in Java. Is this possible? for more details.

OldCurmudgeon
  • 64,482
  • 16
  • 119
  • 213