1 // This example displays the amount of time until new year's in days 2 3 #include "boost/date_time/gregorian/gregorian.hpp" 4 #include <iostream> 5 6 int main()7main() 8 { 9 10 using namespace boost::gregorian; 11 12 date::ymd_type today = day_clock::local_day_ymd(); 13 date new_years_day(today.year + 1,1,1); 14 date_duration dd = new_years_day - date(today); 15 16 std::cout << "Days till new year: " << dd.days() << std::endl; 17 return 0; 18 } 19 20 /* Copyright 2001-2004: CrystalClear Software, Inc 21 * http://www.crystalclearsoftware.com 22 * 23 * Subject to the Boost Software License, Version 1.0. 24 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 25 */ 26 27