フィルターのクリア

weekday of last day of a month

5 ビュー (過去 30 日間)
Indrani
Indrani 2023 年 7 月 17 日
コメント済み: Indrani 2023 年 7 月 17 日
Hi!
How do I find the weekday of the last day of any month in any year?
Thanks!

採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 7 月 17 日
編集済み: Dyuman Joshi 2023 年 7 月 17 日
%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 件のコメント
Indrani
Indrani 2023 年 7 月 17 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by