Effacer les filtres
Effacer les filtres

weekday of last day of a month

6 vues (au cours des 30 derniers jours)
Indrani
Indrani le 17 Juil 2023
Commenté : Indrani le 17 Juil 2023
Hi!
How do I find the weekday of the last day of any month in any year?
Thanks!

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 17 Juil 2023
Modifié(e) : Dyuman Joshi le 17 Juil 2023
%Current Month
y = 2023;
m = 7;
%Get the date of the last day of the month
day = eomday(y,m)
day = 31
%Get the weekday of the last day of the month
[DayNumber,DayName] = weekday(datetime(y,m,day))
DayNumber = 2
DayName = 'Mon'
Edit - In case you want the long name of the day, simply use -
[DayNumber,DayName] = weekday(datetime(y,m,day), 'long')
DayNumber = 2
DayName = 'Monday'
  1 commentaire
Indrani
Indrani le 17 Juil 2023
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by