I am doing this
boost::gregorian::date current_date(boost::date_time::day_clock::local_day());
and I get the following error
‘template<class date_type> class boost::date_time::day_clock’ used without template parameters
Anything that I have to do different ?
reference http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/gregorian.html#date_construct_from_clock
DateTimeFormatter. The LocalDateTime. now() method returns the instance of LocalDateTime class. If we print the instance of LocalDateTime class, it prints the current date and time.
You can get the time from the LocaldateTime object using the toLocalTime() method. Therefore, another way to get the current time is to retrieve the current LocaldateTime object using the of() method of the same class. From this object get the time using the toLocalTime() method.
now() now() method of a LocalDate class used to obtain the current date from the system clock in the default time-zone. This method will return LocalDate based on system clock with default time-zone to obtain the current date.
You're using the wrong day_clock
– use this instead:
boost::gregorian::date current_date(boost::gregorian::day_clock::local_day());
day_clock
in boost::date_time
is a generic interface (template in this case) meant to be used with an externally supplied 'date' type, and you're not supplying that type. day_clock
in boost::gregorian
is a typedef of said interface using boost::gregorian::date
as the supplied 'date' type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With