Search code examples
c++boostboost-date-time

boost::gregorian::date with time?


So far it looks like boost::gregorian::date only has day/month/year. I need to also store hour/minute/second. Can this object handle both? I'm having difficulty understanding how to represent all of this data.


Solution

  • No, this object cannot handle that (because then boost::gregorian::date wouldn't be a ... date).

    If you need a datetime, use boost::posix_time::ptime (which is a tuple of gregorian::date, time_duration).

    If you also need a timezone look at boost::local_time::local_date_time or Boost Locale's date_time