Files
date_time/example/gregorian/days_since_year_start.cpp
Jeff Garland 76bdb1c1fc fix copyright / license issues
[SVN r23815]
2004-07-19 22:13:17 +00:00

26 lines
623 B
C++

#include <iostream>
#include "boost/date_time/gregorian/gregorian.hpp"
int
main()
{
using namespace boost::gregorian;
date today = day_clock::local_day();
//Subtract two dates to get a duration
date_duration days_since_year_start = today - date(today.year(),Jan,1);
std::cout << "Days since Jan 1: " << days_since_year_start.days()
<< std::endl;
return 0;
};
/* Copyright 2001-2004: CrystalClear Software, Inc
* http://www.crystalclearsoftware.com
*
* Subject to the Boost Software License, Version 1.0.
* (See accompanying file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0)
*/