From 936d02927cb2eb5929b8eea0f91b2abde9ee413b Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 21 May 2016 13:19:34 -0400 Subject: [PATCH] Updated Boost datetime Examples Translated (markdown) --- Boost-datetime-Examples-Translated.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Boost-datetime-Examples-Translated.md b/Boost-datetime-Examples-Translated.md index 290017b..d22f2eb 100644 --- a/Boost-datetime-Examples-Translated.md +++ b/Boost-datetime-Examples-Translated.md @@ -221,6 +221,29 @@ look if ported to this library. cout << d1.year() << '-' << d1.month() << '-' << d1.day() << '\n'; } +If your OS supports the `std::locale("de_DE")` the above can be simplified to: + + #include "date.h" + #include "tz.h" + #include + + int + main() + { + using namespace date; + + // create some gregorian objects to output + auto d1 = 2002_y/oct/1; + + using namespace std; + locale loc("de_DE"); + cout << format(loc, "%x\n", local_days{d1}); + cout << format(loc, "%B\n", local_days{d1}); + cout << format(loc, "%A\n", local_days{d1}); + cout << format(loc, "%D\n", local_days{d1}); + cout << format(loc, "%F\n", local_days{d1}); + } + ###Date Period Calculations