Different answers to this question about formatting date + time strings using Boost use different facets.
One answer uses boost::posix_time::time_facet
, and the other answer uses boost::gregorian::date_facet
(note that the latter also includes the time, despite the name of the facet class).
I.e., we have:
boost::posix_time::time_facet("%Y-%m-%d %H:%M:%S");
vs.
boost::gregorian::date_facet("%Y-%m-%d %H:%M:%S");
(with irrelevant characters slightly adjusted by me from the linked answers).
Notice, again, that the boost::gregorian::date_facet
includes the time, so in a sense calling it a date_facet
is a bit deceptive, especially when contrasting it with boost::posix_time::time_facet
, whose developers clearly felt should include "time" in the name of the facet class.
Also notice that boost::posix_time::time_facet
includes the date, which is perhaps more intuitive (though it is possible to think of purely formatting times, but not dates, so maybe it shouldn't be more intuitive that a "time" facet can include the "date" than that a "date" facet can include the "time").
But back specifically to my question: I feel that somehow I must be missing something important involving the gregorian
aspect of things if I use the boost::posix_time
version - people wouldn't bother making a namespace to represent the Gregorian calendar if that doesn't matter, right?
And conversely - is boost::gregorian
's version missing something important from the boost::posix_time
version?
Is one of them a superset of the other? Alternatively, do their features overlap, but differ?
What is the difference between boost::posix_time::time_facet
and boost::gregorian::date_facet
?