Shows how to use xtd::date_time::add_years method.
#include <xtd/console>
#include <xtd/date_time>
#include <xtd/math>
#include <xtd/startup>
class program {
public:
static auto main() {
console::write_line(" Base Date: {0:d}\n", base_date);
for (auto ctr = -1; ctr >= -15; ctr--)
console::write_line("{0,2} year(s) ago: {1:d}", math::abs(ctr), base_date.add_years(ctr));
console::write_line();
for (auto ctr = 1; ctr <= 15; ctr++)
console::write_line("{0,2} year(s) from now: {1:d}", ctr, base_date.add_years(ctr));
}
};
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:85
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.h:175
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10