At first you have to parse the input strings to get a numeric date value that can be subtracted. Which parsing function to use depends on the operating system and the optionally used framework.
With Linux you might use
strptime(3) - Linux man page[
^] and convert the resulting
struct tm
to
time_t
using
mktime(3) - Linux man page[
^]. Those
time_t
values can then be subtracted and converted back to other date types and finally formatted as string.
With Windows and MFC applications, you can use the
COleDateTime Class[
^] which provides the
ParseDateTime
function, the subtraction operator (there is also a version returning a
COleDateTimeSpan Class[
^] ), and format functions.
Note also that subtracting two dates results in a time span which is usually not formatted as "dd/mm/yy" but as number of days, months, or years (or a combination like "n years and m days").
So it makes no sense to provide code while you did not tell us about the used OS and framework, and how to display the result.