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

Shows how to use xtd::date_time::today property.

#include <xtd/xtd>
class program {
public:
static auto main() {
// Get the current date.
auto this_day = date_time::today();
// Display the date in the default (general) format.
console::write_line(this_day.to_string());
console::write_line();
// Display the date in a variety of formats.
console::write_line(this_day.to_string("d"));
console::write_line(this_day.to_string("D"));
console::write_line(this_day.to_string("g"));
}
};
startup_(program::main);
// This code can produce the following output :
//
// 11/5/2025 0:00:00 AM
//
// 11/5/2025
// Wednesday, November 5, 2025
// 11/5/2025 0:00 AM
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:168