Day elapsed since today from a given date
It's weird to take a std::vector&lt;char&gt; instead of a std::string.  If you must take a std::vector&lt;char&gt;, then make two overloaded versions of the function, where the vector variant calls the string variant.

You never use the val parameter.  You probably meant to use it to return the computed result?  However, the computed difference is a double.

strtol() returns a long, but you assign it to an int.  Then you check if that int exceeds INT_MAX or is less than INT_MIN — which is impossible by definition.  Comparing an int with LONG_MAX and LONG_MIN is similarly nonsensical.  Really, all you want to do is check whether errno is non-zero.

You seem to expect the input in YYYYMMDD format, but you don't do any validation other than checking for overflow or underflow.  There are plenty of 8-digit numbers that shouldn't be valid dates.

Unfortunately, the localtime_s() function is Windows-only.  POSIX has localtime_r(), whose arguments are in the other order, but Windows doesn't support it.  You'll probably need an #ifdef _WIN32.

When testing for the validity of x and y, put the early-return failure case first.  That's just a better pattern for error handling, because the successful case doesn't have to be indented another level.