Updated Boost datetime Examples Translated (markdown)

HowardHinnant
2015-09-05 16:02:54 -04:00
parent 1e5139f4cc
commit 37ab2cdb6c

@@ -140,12 +140,16 @@ look if ported to this library.
{
using namespace std::chrono;
using namespace date;
auto today = floor<days>(current_zone()->to_local(system_clock::now()).first);
auto today = floor<days>(current_zone()->
to_local(system_clock::now()).first);
auto current_year = year_month_day{today}.year();
auto days_since_year_start = today - day_point(current_year/jan/1);
std::cout << "Days since Jan 1: " << days_since_year_start.count() << '\n';
auto days_until_year_start = day_point((current_year + years{1})/jan/1) - today;
std::cout << "Days until next Jan 1: " << days_until_year_start.count() << '\n';
std::cout << "Days since Jan 1: "
<< days_since_year_start.count() << '\n';
auto days_until_year_start =
day_point((current_year + years{1})/jan/1) - today;
std::cout << "Days until next Jan 1: "
<< days_until_year_start.count() << '\n';
}
<a name="Last_Day_of_the_Months"></a>