#include <xtd/console>
#include <xtd/date_time>
#include <xtd/startup>
#include <xtd/string>
class program {
public:
static auto main() {
auto date_format = "{0:d}/{0:t}.{0:c}"_s;
auto date1 =
date_time {2014, 9, 8, 16, 0, 0};
console::write_line("Original date: {0} ({1:N0} ticks)\n", string::format(date_format, date1), date1.ticks());
auto date2 = date1.add_seconds(30);
console::write_line("Second date: {0} ({1:N0} ticks)", string::format(date_format, date2), date2.ticks());
console::write_line("Difference between dates: {0} ({1:N0} ticks)\n", date2 - date1, date2.ticks() - date1.ticks());
auto date3 = date1.add_seconds(60 * 60 * 24);
console::write_line("Third date: {0} ({1:N0} ticks)", string::format(date_format, date3), date3.ticks());
console::write_line("Difference between dates: {0} ({1:N0} ticks)", date3 - date1, date3.ticks() - date1.ticks());
}
};
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