Skip to content

Instantly share code, notes, and snippets.

@dmthuc
Last active July 25, 2018 09:59
Show Gist options
  • Save dmthuc/c6b96271cf1fc00444c663f703f42609 to your computer and use it in GitHub Desktop.
Save dmthuc/c6b96271cf1fc00444c663f703f42609 to your computer and use it in GitHub Desktop.
boost::gregorian::date usage:
#include <iostream>
#include <string>
#include <fstream>
#include <cassert>
#include "boost/date_time/gregorian/gregorian.hpp"
using namespace std;
using namespace boost::gregorian;
int main() {
date d(from_undelimited_string(string{"20180101"}));
date d2(from_simple_string("2018-01-01"));
string ext = to_iso_extended_string(d);
assert(ext == "2018-01-01");
for (day_iterator d{start_date}; d <= end_date; ++d) {
ofstream ofs(argv[3] + to_iso_extended_string(*d), std::ofstream::out);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment