-3

Since I want to get the last Wendnesday of every month, use pendulum.parse but sometimes 4 is last week or 5 is last week. How to get easily the day is last Wendnesday of month or not?

enter image description here

martineau
  • 119,623
  • 25
  • 170
  • 301
Ethan
  • 1

1 Answers1

-1

You can use the calendar module from the standard library and compute all dates

calendar.weekday(year, month, day) Returns the day of the week (0 is Monday) for year (1970–…), month (1–12), day (1–31).

As a helper, you can also use from the same module

calendar.monthrange(year, month) Returns weekday of first day of the month and number of days in month, for the specified year and month.

  • ![image](https://user-images.githubusercontent.com/54921730/122260140-e0ebb400-cf0d-11eb-9e3f-c589c6558a3a.png) Uhm..My Question is lame. I wanna know this Wendnes day is last or not, Thank you for ur Answer. I have to think more :) – Ethan Jun 16 '21 at 16:46