Caché Basic Reference
Month
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns the month of the year as an integer between 1 and 12, inclusive.
Synopsis
Month(date)
Arguments
The date argument is any expression that represents a date as a string.
Description
The Month function locates and returns the month portion of a date string as an integer. It performs no range validation on this number. The Month function accepts blanks, slashes (/), hyphens (-), or commas (,) (in any combination) as date component separators. Leading zeros and plus and minus signs may be included or omitted in the input string; leading zeros and signs are omitted from the output integer. The Month function locates the month portion in one of the following three ways:
Examples
The following example uses the Month function to return the current month:
Dim MonthNum
MonthNum = Month(Now)
Print MonthNum
 
The following examples uses the Month function to return the month from the specified date:
Dim MyMonth
MyMonth = Month("09/19/05")  'MyMonth contains 9.
Print MyMonth
 
Dim MyMonth
MyMonth = Month("Sept 19, 2005")  'MyMonth contains 9.
Print MyMonth
 
Dim MyMonth
MyMonth = Month("19 October 2005")  'MyMonth contains 10.
Print MyMonth
 
Dim MyMonth
MyMonth = Month("19 Feb")  'MyMonth contains 2.
Print MyMonth
 
See Also