我最近在QUANTLIB C++中使用了日历函数来执行下面的操作。日历库C++
不幸的是使用QUANTLIB任何项目时间太长编译。我有兴趣以多种不同格式解释日期字符串(Quantlib使我能够做到这一点),如下所示。我也想找到不同格式之间的不同日期之间的差异等。
我的问题是,是否有另一个C++库,使我能够做所有这些事情(希望能够更快地编译我的项目) ?
以下简单的项目似乎需要永远编译。
我唯一的前提是它编译静态。
#include <iostream>
#include <ql/quantlib.hpp>
#include <ql/utilities/dataparsers.hpp>
using namespace std;
using namespace QuantLib;
int main()
{
Calendar cal = Australia();
const Date dt(21, Aug, 1971);
bool itis = false;
itis = cal.isBusinessDay(dt);
cout << "business day yes? " << itis << endl;
cout << "The calendar country is: " << cal.name() << endl;
// now convert a string to a date.
string mydate = "05/08/2016";
const Date d = DateParser::parseFormatted(mydate,"%d/%m/%Y");
cout << "The year of this date is: " << d.year() << endl;
cout << "The month of this date is: " << d.month() << endl;
cout << "The day of this date is: " << d.dayOfMonth() << endl;
cout << "The date " << mydate << " is a business day yes? " << cal.isBusinessDay(d) << endl;
}
你可以试试这个:https://howardhinnant.github.io/date/date.html不知道它是否有你需要的所有东西。 – Rostislav