Missing number, treated as zero formatdate

by Ksmart   Last Updated May 15, 2019 17:23 PM

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.
<to be read again>
\let


Related Questions


"Missing number treated as zero" error

Updated August 26, 2018 18:23 PM

Table error: Missing number treated as zero

Updated August 27, 2018 13:23 PM

Write pseudocode, missing number treated as zero

Updated January 13, 2019 12:23 PM