I have a macro which will read in arguments in date format e.g. {2012-11-08}
\usepackage{datetime}
\def\customdate#1#2#3#4-#5-#6\relax{%
\shortmonthname[#5] '#3#4%
}
However, in some instances I would like the output to print something else in place of a date, perhaps "Present", "ongoing" or some other string. I had hoped to use some kind of if-statement or use an on-error type command, but I cannot find anything appropriate.
How can I write another macro, or add some kind of conditional statement to the above macro so that it will output the date formatted as requested, but will return the argument unchanged if it does not have the "####-##-##" format?
Cheers



\customdate? You should have something in mind. Also, what a non standard argument should print? – egreg Nov 05 '14 at 23:04\def#8part of your answer do? Why\def?\defwhat? – cfr Nov 05 '14 at 23:23\def(like\relaxin this context) is just some arbitrary token that's not expected to appear in the input,#8is the original string used in the case a?was seen (it would be possible to reconstitute the original string from the earlier#but just keeping it is easier. – David Carlisle Nov 05 '14 at 23:26