xtd 0.2.0
Loading...
Searching...
No Matches
date_time_add.cpp

Shows how to use xtd::date_time::add method.

#include <xtd/console>
#include <xtd/date_time>
#include <xtd/startup>
#include <chrono>
class program {
public:
static auto main() {
// Calculate what day of the week is 36 days from this instant.
auto today = xtd::date_time::now();
auto duration = std::chrono::days {36};
auto answer = today.add(duration);
xtd::console::write_line("{0}", today);
xtd::console::write_line("{0}", answer);
}
};
startup_(program::main);
// This code can produces the following output:
//
// Wed Jan 12 14:06:34 2022
// Thu Feb 17 14:06:34 2022
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static date_time now() noexcept
Gets a xtd::date_time object that is set to the current date and time on this computer,...
#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:166