MONTH(date)

Returns the month from a given date (Integer).


dateThe date you want the month of (Date).

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 docs.microsoft.com

Debug.Print Now()                      '= 01/09/2021 23:56:17  
Debug.Print Month(Now()) '= 9
Debug.Print Month(#12/6/2020#) '= 12
Debug.Print Month("1 January 2020") '= 1
Debug.Print Month("February 12, 2020") '= 2
Debug.Print Month("01/02/2020") '= 2
Debug.Print Month("1 Feb 2020") '= 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

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