if (inherits(index, "Date") || is.character(index))
{
tryCatch(indexAsDate <- as.Date(index), error=function(e) stop("Unrecognized index format"))
if (inherits(index, "Date") || is.character(index))
{
tryCatch(indexAsDate <- as.Date(index), error=function(e) stop("Unrecognized index format"))