1 2 #include "boost/date_time/gregorian/gregorian.hpp" 3 #include <iostream> 4 5 int main()6main() 7 { 8 9 using namespace boost::gregorian; 10 11 date today = day_clock::local_day(); 12 //Subtract two dates to get a duration 13 date_duration days_since_year_start = today - date(today.year(),Jan,1); 14 std::cout << "Days since Jan 1: " << days_since_year_start.days() 15 << std::endl; 16 return 0; 17 } 18 19 /* Copyright 2001-2004: CrystalClear Software, Inc 20 * http://www.crystalclearsoftware.com 21 * 22 * Subject to the Boost Software License, Version 1.0. 23 * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 24 */ 25 26