Purpose
Returns the month component (1 - 12) of a date value. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
Month( date_expr )
date_expr is a date expression.
Return Value
SmallInt value from 1 to 12, inclusive.
Description
The Month() function returns an integer, representing the month component (one to twelve) of the specified date.
Examples
The following example shows how you can extract just the month component from a particular date value, using the Month() function.
If Month(CurDate()) = 12 Then
'
' ... then it is December...
'
End If
You can also use the Month() function within the SQL Select statement. The following Select statement extracts only particular rows from the Orders table. This example assumes that the Orders table has a Date column, called Order_Date. The Select statement's Where clause tells MapInfo Pro to only select the orders from December of 2013.
Open Table "orders"
Select *
From orders
Where Month(orderdate) = 12 And Year(orderdate) = 2013
See Also:
CurDate() function, Day() function, Minute() function, Month() function, Second() function, Weekday() function, Year() function