1 /* Copyright (c) 2002,2003 CrystalClear Software, Inc. 2 * Use, modification and distribution is subject to the 3 * Boost Software License, Version 1.0. (See accompanying 4 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 5 * Author: Jeff Garland 6 */ 7 8 #include "boost/date_time/gregorian/gregorian.hpp" 9 #include <iostream> 10 11 int main()12main() 13 { 14 15 boost::gregorian::date d1(boost::gregorian::day_clock::local_day()); 16 std::cout << "Check the printed date by hand: " 17 << boost::gregorian::to_iso_string(d1) << std::endl; 18 19 using namespace boost::gregorian; 20 date::ymd_type ymd = day_clock::local_day_ymd(); 21 std::cout << ymd.year << "-" 22 << ymd.month.as_long_string() << "-" 23 << ymd.day << std::endl; 24 25 date d2(day_clock::universal_day()); 26 std::cout << "Getting UTC date: " 27 << to_iso_string(d2) << std::endl; 28 29 date::ymd_type ymd2 = day_clock::universal_day_ymd(); 30 std::cout << ymd2.year << "-" 31 << ymd2.month.as_long_string() << "-" 32 << ymd2.day << std::endl; 33 34 return 0; 35 36 } 37 38