{"id":276,"date":"2014-03-31T15:38:02","date_gmt":"2014-03-31T13:38:02","guid":{"rendered":"https:\/\/blog.ramses-pyramidenbau.de\/?p=276"},"modified":"2014-03-31T16:13:02","modified_gmt":"2014-03-31T14:13:02","slug":"getting-date-and-time-in-c11","status":"publish","type":"post","link":"https:\/\/blog.vmexit.de\/?p=276","title":{"rendered":"Getting Date and Time in C++11"},"content":{"rendered":"<p>You remember the days when it was necessary to use <em>strftime<\/em> to convert time to human readable strings? Even in C++ it actually was a pain in the ass.<\/p>\n<p>This is the way how you can do in in C++11:<\/p>\n<pre class=\"brush: cpp; light: true; title: ; notranslate\" title=\"\">\r\n#include &lt;iostream&gt;\r\n#include &lt;iomanip&gt;\r\n#include &lt;ctime&gt;\r\n\r\nint main()\r\n{\r\n    auto t = std::time(nullptr);\r\n    auto tm = *std::localtime(&amp;t);\r\n    std::cout &lt;&lt; std::put_time(&amp;tm, &quot;%d-%m-%Y %H-%M-%S&quot;) &lt;&lt; std::endl;\r\n}\r\n<\/pre>\n<p>Hell yeah, I love C++11!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You remember the days when it was necessary to use strftime to convert time to human readable strings? Even in C++ it actually was a pain in the ass. This is the way how you can do in in C++11: #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;ctime&gt; int main() { auto t = std::time(nullptr); auto tm &hellip; <a href=\"https:\/\/blog.vmexit.de\/?p=276\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Getting Date and Time in C++11<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-276","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276"}],"version-history":[{"count":8,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions"}],"predecessor-version":[{"id":284,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=\/wp\/v2\/posts\/276\/revisions\/284"}],"wp:attachment":[{"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vmexit.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}