Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.42 KB

DateUtils.md

File metadata and controls

44 lines (29 loc) · 1.42 KB

DateUtils

Contents

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);

snippet source | anchor

will produce:

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

snippet source | anchor

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.


Back to User Guide