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

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

#include <xtd/xtd>
using namespace xtd::globalization;
class program {
public:
static auto main() {
auto local_date = date_time::now();
auto culture_names = array {"en-US", "en-GB", "fr-FR", "de-DE", "ru-RU"};
for (auto culture_name : culture_names) {
auto culture = culture_info {culture_name};
console::write_line("{}: {}", culture_name, local_date.to_string(culture));
}
}
};
startup_(program::main);
// This code can produce the following output :
//
// en-US: 10/23/2025 1:02:39 AM
// en-GB: 23/10/2025 01:02:39
// fr-FR: 23/10/2025 01:02:39
// de-DE: 23.10.2025 01:02:39
// ru-RU: 23.10.2025 01:02:39
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:63
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,...
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition culture_info.hpp:43
#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
Contains classes that define culture-related information, including language, country/region,...
Definition culture_info.hpp:20