プログラミングのメモ

プログラミングの学び直し備忘録

Excel :関数:日付/時刻関数

日付/時刻関数

年月日の取得

時分秒の取得

曜日の取得

日付から曜日の数値を取り出す:WEEKDAY

    '今日の曜日
    Debug.Print Application.WorksheetFunction.Text(Now, "aaaa")
土曜日
    
    '戻り値は1~7(日~土)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 1)
 7 
    '戻り値は1~7(月~日)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 2)
 6 
    '戻り値は0~6(月~日)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 3)
 5 
    '戻り値は1~7(月~日)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 11)
 6 
    '戻り値は1~7(火~月)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 12)
 5 
    '戻り値は1~7(水~火)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 13)
 4 
    '戻り値は1~7(木~水)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 14)
 3 
    '戻り値は1~7(金~木)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 15)
 2 
    '戻り値は1~7(土~金)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 16)
 1 
    '戻り値は1~7(日~土)
    Debug.Print Application.WorksheetFunction.WEEKDAY(Now, 17)
 7 

日付から曜日を表示:TEXT関数

  • 日付から曜日を表示(日本語_通常):TEXT(日付, "aaaa")
  • 日付から曜日を表示(日本語_短縮):TEXT(日付, "aaa")
  • 日付から曜日を表示(英語_通常):TEXT(日付, "dddd")
  • 日付から曜日を表示(英語_短縮):TEXT(日付, "ddd")
    '曜日
    Debug.Print Application.WorksheetFunction.Text(Now, "aaaa")
土曜日

    '曜日_短縮
    Debug.Print Application.WorksheetFunction.Text(Now, "aaa") '曜日_英語
    Debug.Print Application.WorksheetFunction.Text(Now, "dddd")
Saturday

    '曜日_英語_短縮
    Debug.Print Application.WorksheetFunction.Text(Now, "ddd")
Sat


週番号の取得

日付の変換

日付のシリアル値

時刻のシリアル値

期日

期間