Open
Description
See the original report DevCom-10896610. (Internal: VSO-2467874 / AB#2467874 ).
#include <chrono>
#include <exception>
#include <format>
#include <iostream>
#include <locale>
#include <string>
using namespace std;
using namespace std::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)
int main() {
zoned_time<system_clock::duration> zonedTime{current_zone(), system_clock::now()};
try { // Problem #1
auto 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;
}
}