Updated Boost datetime Examples Translated (markdown)

Howard Hinnant
2017-07-07 18:16:04 -04:00
parent 018dda723c
commit 8c3531f259

@@ -153,30 +153,30 @@ main()
```
<a name="Localization_Demonstration"></a>
### Localization Demonstration
```c++
#include "date.h"
#include <iomanip>
#include <iostream>
#include "date.h"
#include <iomanip>
#include <iostream>
// Define a series of char arrays for short and long name strings
// to be associated with German date output (US names will be
// retrieved from the locale).
const char* const de_long_month_names[] =
{
// Define a series of char arrays for short and long name strings
// to be associated with German date output (US names will be
// retrieved from the locale).
const char* const de_long_month_names[] =
{
"Januar", "Februar", "Marz", "April", "Mai",
"Juni", "Juli", "August", "September", "Oktober",
"November", "Dezember", "NichtDerMonat"
};
};
const char* const de_long_weekday_names[] =
{
const char* const de_long_weekday_names[] =
{
"Sonntag", "Montag", "Dienstag", "Mittwoch",
"Donnerstag", "Freitag", "Samstag"
};
};
int
main()
{
int
main()
{
using namespace date;
// create some gregorian objects to output
@@ -194,17 +194,17 @@ main()
cout << static_cast<unsigned>(d1.month()) << '/' << d1.day()
<< '/' << d1.year() << '\n';
cout << d1.year() << '-' << d1.month() << '-' << d1.day() << '\n';
}
}
```
If your OS supports the `std::locale("de_DE")` the above can be simplified to:
```c++
#include "date.h"
#include "tz.h"
#include <iostream>
#include "date.h"
#include "tz.h"
#include <iostream>
int
main()
{
int
main()
{
using namespace date;
// create some gregorian objects to output
@@ -217,8 +217,8 @@ If your OS supports the `std::locale("de_DE")` the above can be simplified to:
cout << format(loc, "%A\n", local_days{d1});
cout << format(loc, "%D\n", local_days{d1});
cout << format(loc, "%F\n", local_days{d1});
}
}
```
<a name="Date_Period_Calculations"></a>
### Date Period Calculations