From d0eeca9fae05ceea57197fb630d94bb01384cb2b Mon Sep 17 00:00:00 2001 From: Emile Cormier Date: Thu, 30 Jul 2015 16:19:41 -0300 Subject: [PATCH] Updated Examples and Recipes (markdown) --- Examples-and-Recipes.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Examples-and-Recipes.md b/Examples-and-Recipes.md index 3916664..3f45cea 100644 --- a/Examples-and-Recipes.md +++ b/Examples-and-Recipes.md @@ -13,7 +13,10 @@ using namespace std::chrono; using namespace date; // Component values (as obtained from an UI form, for example) int y=2015, m=7, d=30, h=12, min=34, s=56; -system_clock::time_point = day_point(year(y)/m/d) + +auto ymd = year(y)/m/d; // Yields a year_month_day type +if (!ymd.ok()) + throw std::runtime_error("Invalid date"); +system_clock::time_point = day_point(ymd) + hours(h) + minutes(min) + seconds(s); ```