xtd 0.2.0
sprintf_date_time.cpp

Shows how to use xtd::string::sprintf method.

#include <xtd/console>
#include <xtd/date_time>
#include <xtd/environment>
#include <xtd/string>
using namespace xtd;
auto main() -> int {
auto now = xtd::date_time::now();
}
// This code can be produce the following output :
//
// Sat Jan 2 03:04:05 2021
// 2021
// 2021
// 21
// 21
// 21
// 20
// 20
// 2020
// 20
// Jan
// Jan
// January
// 01
// 01
// 00
// 00
// 00
// 00
// 53
// 53
// 002
// 02
// 02
// 2
// 02
// Sat
// Saturday
// 6
// 6
// 6
// 6
// 03
// Jan
// 03
// 03
// 04
// 04
// 05
// 05
// Sat Jan 2 03:04:05 2021
// Sat Jan 2 03:04:05 2021
// 01/02/21
// 01/02/21
// 03:04:05
// 03:04:05
// 01/02/21
// 2021-01-02
// 03:04:05 AM
// 03:04
// 03:04:05
// AM
// +0100
// CET
static std::ostream out
Gets the standard output stream. A std::basic_ostream<char_t> that represents the standard output str...
Definition console.hpp:52
static xtd::string sprintf(const string &format, const date_time &value)
Returns a xtd::string that represents the current xtd::date_time.
static date_time now() noexcept
Gets a xtd::date_time object that is set to the current date and time on this computer,...
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8