Show how to use format xtd::format class with std::chrono utilities.
#include <xtd/console>
#include <xtd/date_time>
#include <xtd/environment>
#include <xtd/string>
auto main() -> int {
auto date_time = std::chrono::system_clock::now();
console::out << string::format(
"{}",
date_time) << environment::new_line;
console::out << string::format(
"{:d}",
date_time) << environment::new_line;
console::out << string::format(
"{:D}",
date_time) << environment::new_line;
console::out << string::format(
"{:t}",
date_time) << environment::new_line;
console::out << string::format(
"{:T}",
date_time) << environment::new_line;
console::out << string::format(
"{:f}",
date_time) << environment::new_line;
console::out << string::format(
"{:F}",
date_time) << environment::new_line;
console::out << string::format(
"{:g}",
date_time) << environment::new_line;
console::out << string::format(
"{:G}",
date_time) << environment::new_line;
console::out << string::format(
"{:h}",
date_time) << environment::new_line;
console::out << string::format(
"{:H}",
date_time) << environment::new_line;
console::out << string::format(
"{:i}",
date_time) << environment::new_line;
console::out << string::format(
"{:I}",
date_time) << environment::new_line;
console::out << string::format(
"{:j}",
date_time) << environment::new_line;
console::out << string::format(
"{:J}",
date_time) << environment::new_line;
console::out << string::format(
"{:k}",
date_time) << environment::new_line;
console::out << string::format(
"{:K}",
date_time) << environment::new_line;
console::out << string::format(
"{:l}",
date_time) << environment::new_line;
console::out << string::format(
"{:L}",
date_time) << environment::new_line;
console::out << string::format(
"{:m}",
date_time) << environment::new_line;
console::out << string::format(
"{:M}",
date_time) << environment::new_line;
console::out << string::format(
"{:n}",
date_time) << environment::new_line;
console::out << string::format(
"{:n}",
date_time) << environment::new_line;
console::out << string::format(
"{:O}",
date_time) << environment::new_line;
console::out << string::format(
"{:s}",
date_time) << environment::new_line;
console::out << string::format(
"{:t}",
date_time) << environment::new_line;
console::out << string::format(
"{:T}",
date_time) << environment::new_line;
console::out << string::format(
"{:u}",
date_time) << environment::new_line;
console::out << string::format(
"{:U}",
date_time) << environment::new_line;
console::out << string::format(
"{:v}",
date_time) << environment::new_line;
console::out << string::format(
"{:V}",
date_time) << environment::new_line;
console::out << string::format(
"{:y}",
date_time) << environment::new_line;
console::out << string::format(
"{:Y}",
date_time) << environment::new_line;
console::out << string::format(
"{:z}",
date_time) << environment::new_line;
console::out << string::format(
"{:Z}",
date_time) << environment::new_line;
}
Represents an instant in time, typically expressed as a date and time of day.
Definition date_time.h:85
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10