Missing number, treated as zero formatdate

So I am fairly new to latex and most of my use of it is in combination with Rmarkdown files, but am trying to integrate the two. Essentially, I have a command which takes is supposed to be a date (in the format of MM/DD/YYYY) but is interpreted as a string (or characters). I want to create a command that can convert this variable/string to a longer format. Essentially there are places in the document I would like to refer to the date in the MM/DD/YYYY format, and places I would like for it to print the date in the format of say December 31, 2018. Trying to use the \usdate and \formatdate from the datetime package to accomplish this.

This is a synopsis of the code I think would be relevant to understanding my issue

\usepackage{stringstrings}
\usepackage{datetime}
\usdate
\newcommand{\acctdate}{12/31/2018}
\newcommand{\longerdate}[1]{
\formatdate{\substring[v]{#1}{4}{5}}{\substring[v]{#1}{1}{2}}{\substring[v]{#1}{7}{10}}
}


and in the actual report I call

\longerdate{\acctdate}


If I try and run this I receive the error:

! Missing number, treated as zero.
\let


If you still have the notation mm/dd/yyyy then you can use a simple definition:

\documentclass{article}
\usepackage{datetime}
\usdate
\newcommand\acctdate{12/31/2018}
\newcommand\longerdate[1]{\expandafter\LongerDate#1;}
\def\LongerDate#1/#2/#3;{\formatdate{#2}{#1}{#3}}
\begin{document}

and in the actual report I call
\longerdate{\acctdate}

\end{document}


With TeX Live 2019 (or an update version of MiKTeX), you can exploit \expanded:

\documentclass{article}
\usepackage{datetime}

\usdate

\newcommand{\longerdate}[1]{%
\expanded{\noexpand\makelongerdate#1/}%
}
\def\makelongerdate#1/#2/#3/{\formatdate{#2}{#1}{#3}}

\newcommand{\acctdate}{12/31/2018}

\newcommand{\fixedyear}{2019}
\newcommand{\otherdate}{12/31/\fixedyear}

\begin{document}

\longerdate{\acctdate}

\longerdate{12/31/2018}

\longerdate{\otherdate}

\end{document}


With a more classical implementation,

\documentclass{article}
\usepackage{datetime}

\usdate

\newcommand{\longerdate}[1]{%
\begingroup\edef\x{\endgroup\noexpand\makelongerdate#1/}\x
}
\def\makelongerdate#1/#2/#3/{\formatdate{#2}{#1}{#3}}

\newcommand{\acctdate}{12/31/2018}

\newcommand{\fixedyear}{2019}
\newcommand{\otherdate}{12/31/\fixedyear}

\begin{document}

\longerdate{\acctdate}

\longerdate{12/31/2018}

\longerdate{\otherdate}

\end{document}