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