month_cnv {astrolibR} | R Documentation |
Convert between a month name and the equivalent number
month_cnv(monthinput, up=FALSE, short=FALSE)
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) |
For example, this function converts from 'January' to 1, or vice-versa. String output can be in the form "january", "JANUARY", "jan", "JAN".
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.
Written by: Joel Wm. Parker, SwRI, 1998
R adaptation by Arnab Chakraborty June 2013
month_cnv('Apr') month_cnv(4,short=TRUE,up=TRUE)