Caché Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Returns a string indicating the specified month.
month The numeric designation of the month. For example, January is 1, February is 2, and so on.
abbreviate Optional — Boolean value that indicates if the month name is to be abbreviated. If omitted, the default is False (0), which means that the month name is not abbreviated.
The following example uses the MonthName and Month functions to return the month name for a date expression:
Dim MName
Mydate = "1/12/1953"
MName = MonthName(Month(Mydate))
Println MName
The following example uses the MonthName and Date functions to return the abbreviated month name for the current date:
Dim MName
CurrDate = Date
MNum = Month(CurrDate)
MName = MonthName(MNum,1)
Println MName
In the following example, a month number is out of the range of 1 through 12. MonthName returns a question mark:
Dim MyVar
MyVar = MonthName(13)
Println MyVar
See Also