use sscanf to extract info from a timestamp string. Now it supports 'YYY...

...Y-MM-DD' format. add a simple test case
I see now that the terminating 0 is already handled by the caller's correct use of the std::string constructor. You can remove this comment.