MONTH

MONTH(date)

Returns the month from a given date (Integer).


dateThe date you want the month of (Variant).

REMARKS
* The "date" can be any date, numeric or string expression.
* If "date" is Null, then Null is returned.
* The value returned is between 1 and 12.
* You can use the DATE function to return the current system date.
* You can use the DAY function to return the day from a given date.
* You can use the YEAR function to return the year from a given date.
* The equivalent .NET function is Microsoft.VisualBasic.DateAndTime.Month
* For the Microsoft documentation refer to learn.microsoft.com

Debug.Print Now()                      '= 01/09/2024 23:56:17  
Debug.Print Month(Now()) '= 9
Debug.Print Month(#12/6/2024#) '= 12
Debug.Print Month("1 January 2024") '= 1
Debug.Print Month("February 12, 2020") '= 2
Debug.Print Month("01/02/2024") '= 2
Debug.Print Month("1 Feb 2024") '= 2
Debug.Print Month(1) '= 12
Debug.Print Month(15) '= 1
Debug.Print Month(30) '= 1
Debug.Print Month(32) '= 1
Debug.Print Month(33) '= 2
Debug.Print Month(60) '= 2
Debug.Print Month(61) '= 3
Debug.Print Month(256) '= 9
Debug.Print Month(365) '= 12
Debug.Print Month(2000) '= 6

Dim lDate As Date
lDate = 32616
Debug.Print Month(lDate) '= 4

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top