mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-06 14:14:27 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -221,6 +221,29 @@ look if ported to this library.
|
|||||||
cout << d1.year() << '-' << d1.month() << '-' << d1.day() << '\n';
|
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 <iostream>
|
||||||
|
|
||||||
|
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});
|
||||||
|
}
|
||||||
|
|
||||||
<a name="Date_Period_Calculations"></a>
|
<a name="Date_Period_Calculations"></a>
|
||||||
###Date Period Calculations
|
###Date Period Calculations
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user