MonthName 関数

適用先
Access for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

指定した月を示す文字列を返します。

構文

MonthName(month [, 短縮 ] )

MonthName 関数構文の引数は次のとおりです。

引数 説明
month 必須。 月を指定する数値。 たとえば、1 月は「1」、2 月は「2」などです。
abbreviate 省略可能。 月の名前を省略形にするかどうかを指定するブール値です。 省略した場合の既定値は False で、月の名前は省略されません。

クエリの例

Expression 結果
SELECT Monthname("10") AS Expr1 FROM ProductSales; "month" を表す数値の月の "Full" 名を返します。 結果: "10 月"
SELECT Monthname("10",True) AS MonthTest FROM ProductSales; "month" を表す数値の月の "短縮" 名を返し、列 "MonthTest" に表示します。結果: "Oct" は、テーブル "ProductSales" からフィールド "DateofSale" の値の "month" の "Full" 名を返し、列 "MonthTest" に表示されます。

適切な日付関数を選択する