DateUtils

Usage

You can easily create and print C++11 dates and times.

For example:

std::chrono::system_clock::time_point dateTime =
    ApprovalTests::DateUtils::createUtcDateTime(2000, 1, 13, 3, 34, 45);

std::string dateTimeString = ApprovalTests::DateUtils::toString(dateTime);

(See snippet source)

will produce:

Thu 2000-01-13 03:34:45 UTC

(See snippet source)

Times are printed in UTC, as this is a testing utility and consistency across machines is desirable.

There is an overload of DateUtils::toString() that takes a format string, should you wish to print it differently.