$return = Month(date[,date_format])
Where:
$return |
A number from 1 to 12 representing the month of the year. |
date |
The input date. |
date_format |
can be one of the following: DMY (date is in DD/MM/YYYY format.) MDY (date is in MM/DD/YYYY format.) YMD (date is in YYYY/MM/DD or YYYY-MM-DD format.)
date_format may be omitted, in which case the date format is taken from the "Option DateFormat" command. If the "Option DateFormat" command is also omitted, then the date format is assumed to be the system short date format. |
date and date_format may be a variables.
The Month command returns a number between 1 and 12 for the month of the year of the input date.
Examples
$MonthOfYear = Month($DATE) |
'Returns the number of the current month in system short date format |
$MonthOfYear = Month("2015-01-01", YMD) |
'Returns 01 |
$MonthOfYear = Month("2015-02-01", ymd) |
'Returns 02 |
Sample Script
' Display the date.
$Today = $DATE
$DayNumber = Day($Today)
$MonNumber = Month($Today)
$Year = Year($Today)
'Remove leading zero
$DayNumber = Trim($DayNumber,"0",left)
$MonNumber = Trim($MonNumber,"0",left)
MsgBox("Today is day " & $DayNumber _
& " of month " & $MonNumber _
& " of year " & $Year)
exit
See Also:
TN3270 Plus is continually being improved. To learn more about the latest enhancements, please review our Version History web page.