Updated Boost datetime Examples Translated (markdown)

Howard Hinnant
2017-07-07 20:29:08 -04:00
parent 55c99382eb
commit 70d5caa240

@@ -322,26 +322,24 @@ main()
```
<a name="Month_Adding"></a>
### Month Adding
```c++
#include "tz.h"
#include <iostream>
#include "date.h"
#include "tz.h"
#include <iostream>
int
main()
{
using namespace std::chrono;
using namespace date;
auto zone = current_zone();
auto d = year_month_day{floor<days>(
zone->to_local(system_clock::now()))};
auto d2 = d + months{1};
if (!d2.ok())
d2 = d2.year()/d2.month()/last; // boost snaps to last
std::cout << "Today is: " << d << ".\n"
<< "One month from today will be: " << d2 << '\n';
}
int
main()
{
using namespace std::chrono;
using namespace date;
auto d = year_month_day{floor<days>(make_zoned(current_zone(),
system_clock::now()).get_local_time())};
auto d2 = d + months{1};
if (!d2.ok())
d2 = d2.year()/d2.month()/last; // boost snaps to last
std::cout << "Today is: " << d << ".\n"
<< "One month from today will be: " << d2 << '\n';
}
```
<a name="Time_Math"></a>
### Time Math