Restituisce un numero intero tra 0 e 12 (compreso), a rappresentare i mesi dell'anno.
Sintassi
Month(date)
Argomenti:
Date: obbligatorio. Qualsiasi espressione che può rappresentare una data.
Formati di data supportati:
MM-DD-YYYYMM/DD/YYYYDD-MM-YYYYDD/MM/YYYYYYYY-MM-DDYYYY/MM/DDNote
Nell'esempio seguente viene utilizzata la funzione Month per restituire il mese corrente.
Esempio 1
Dim MyVar MyVar = Month(Now) 'Output: If current month is January, then it returns 1
Esempio 2
Dim MyDate, MyMonth MyDate = "21/01/2025" MyMonth = Month(MyDate) 'Output: 1 (January)
Esempio 3
Dim MyDate1, MyMonth1
MyDate1 = DateAdd("m", 5, "21/01/2025")
MyMonth1 = Month(MyDate1)
'Output: 6 (June)
Esempio 4
Dim MyDateTime2, MyMonth2 MyDateTime2 = "21/01/2025 18:45:30" ' Date-Time value. MyMonth2 = Month(MyDateTime2) ' Returns the month part of the date-time value. 'Output: 1 (January)