BCS c++ Get Current Date


There are those times when the current date (in sting format) is required. This c++ utility offers a solution to this problem.
[codesyntax lang=”cpp”]

string cla::cds(){
	date d1 = boost::gregorian::day_clock::local_day();
	date::ymd_type ymd = d1.year_month_day();
	greg_weekday wd = d1.day_of_week();
	stringstream ss;
	ss << wd.as_long_string() << " " << ymd.month.as_long_string() << " " << ymd.day << ", " << ymd.year;
	return ss.str();
}

[/codesyntax]
Do not omit the required library “boost_date_time” (ie -lboost_date_time).
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *