You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<chrono>
#include<exception>
#include<format>
#include<iostream>
#include<locale>
#include<string>usingnamespacestd;usingnamespacestd::chrono;// Set C++ Language standard to be used to ISO C++20 Standard// Install the Slovak language first: Settings -> Time & Language -> Language -> Preferred Languages -> Add a language// Set System Region: Settings -> Time & Language -> Region -> Region Format -> Slovak (Slovakia)intmain() {
zoned_time<system_clock::duration> zonedTime{current_zone(), system_clock::now()};
try { // Problem #1auto info = zonedTime.get_info();
cout << "Zone abbrev: " << info.abbrev << endl;
} catch (const exception& e) {
cout << "Exception: " << e.what() << endl;
}
try { // Problem #2
string zonedTimeString = vformat(locale::classic(), "{:%Y-%m-%dT%H:%M:%S}", make_format_args(zonedTime));
cout << "Time string: " << zonedTimeString << endl;
} catch (const exception& e) {
cout << "Exception: " << e.what() << endl;
}
}