month_cnv: Convert between a month name and the equivalent number
Description
Convert between a month name and the equivalent number
Usage
month_cnv(monthinput, up=FALSE, short=FALSE)
Arguments
monthinput
either a string ('January', 'Jan', 'Decem', etc.) or
a number from 1 to 12, scalar or array.
up
if =TRUE and if a string is being returned, it will be in all
uppercase letters. If = FALSE, all lowercase letters are used (default = FALSE)
short
if =TRUE and if a string is being returned, only the first
three letters are returned (default = FALSE)
Value
If the input is a string, the output is the matching month number.If
an input string is not a valid month name, -1 is returned.
If the input is a number, the output is the matching month name. See
details for formats.
Details
For example, this function converts from 'January' to 1, or vice-versa. String
output can be in the form "january", "JANUARY", "jan", "JAN".