Updated Boost datetime Examples Translated (markdown)

Howard Hinnant
2017-07-07 21:28:52 -04:00
parent 49e304ee7a
commit 867af4cfb2

@@ -432,23 +432,23 @@ main()
``` ```
<a name="Time_Periods"></a> <a name="Time_Periods"></a>
### Time Periods ### Time Periods
```c++
#include "date.h"
#include <iostream>
#include "date.h" int
#include <iostream> main()
{
int using namespace std::chrono;
main() using namespace date;
{ auto d = sys_days{2002_y/feb/1}; // an arbitrary date
using namespace std::chrono; auto t = d + 3h + 5s; //an arbitray time on that day
using namespace date; if (d <= t && t < d + days{1})
auto d = sys_days(2002_y/feb/1); // an arbitrary date std::cout << d << " contains " << t << '\n';
auto t = d + 3h + 5s; //an arbitray time on that day // Time periods not part of this library but can be built
if (d <= t && t < d + days{1}) // from a pair of time_points.
std::cout << d << " contains " << t << '\n'; }
// Time periods not part of this library but can be built ```
// from a pair of time_points.
}
<a name="Simple_Time_Zones"></a> <a name="Simple_Time_Zones"></a>
### Simple Time Zones ### Simple Time Zones