#include "date/tz.h"
#include
#include
int main() {
// Example broken-down time components
int year = 2023;
int month = 3; // March
int day = 12;
int hour = 2;
int minute = 0;
// Timezone
std::string timezone = "America/New_York";
//std::string timezone = "US/Central";
// Construct a local_time type from the broken-down time
auto localTime = date::local_days{date::year{year}/month/day} + std::chrono::hours{hour} + std::chrono::minutes{minute};
// Convert local time to zoned time with DST adjustments
auto zonedTime = date::make_zoned(timezone, localTime);
// Output the original and converted date-time
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78727004/error-while-converting-broken-time-into-correct-date-time-with-timezone-and-dst[/url]
// Construct a local_time type from the broken-down time auto localTime = date::local_days{date::year{year}/month/day} + std::chrono::hours{hour} + std::chrono::minutes{minute};
// Convert local time to zoned time with DST adjustments auto zonedTime = date::make_zoned(timezone, localTime);
// Output the original and converted date-time std::cout