#include <boost/date_time/gregorian/gregorian.hpp>
#include <iostream>
using namespace std;
int main()
{
boost::gregorian::date d(boost::gregorian::day_clock::local_day());
cout << d.year()<<"." << d.month()<<"." <<d.day() <<endl;
getchar();
return 0;
}
(2)代码 编译。输入命令:
linuxidc@linuxidc:~/www.linuxidc.com/Linux公社 -/boost_1_69_0$ g++ -I /usr/local/boost/include -L /usr/local/boost/lib linuxidc.com.Boost.cpp -o linuxidc.com
(3)执行程序。输入命令:
linuxidc@linuxidc:~/www.linuxidc.com/Linux公社 -/boost_1_69_0$ ./linuxidc.com
2019.Mar.20
截图如下
OK,搞定。
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx