mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-06 22:24:27 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -421,7 +421,8 @@ look if ported to this library.
|
|||||||
|
|
||||||
// eastern timezone is utc-5
|
// eastern timezone is utc-5
|
||||||
zone = locate_zone("America/New_York");
|
zone = locate_zone("America/New_York");
|
||||||
auto t1 = day_point(2001_y/dec/31) + 19h + 0s; // 5 hours b/f midnight NY time
|
// 5 hours b/f midnight NY time
|
||||||
|
auto t1 = day_point(2001_y/dec/31) + 19h + 0s;
|
||||||
std::cout << "\nUTC <--> New York while DST is NOT active (5 hours)\n";
|
std::cout << "\nUTC <--> New York while DST is NOT active (5 hours)\n";
|
||||||
auto t2 = zone->to_sys(t1);
|
auto t2 = zone->to_sys(t1);
|
||||||
std::cout << t1 << " in New York is " << t2 << " UTC time\n";
|
std::cout << t1 << " in New York is " << t2 << " UTC time\n";
|
||||||
@@ -429,7 +430,8 @@ look if ported to this library.
|
|||||||
auto t3 = zone->to_local(t2).first; // back should be the same
|
auto t3 = zone->to_local(t2).first; // back should be the same
|
||||||
std::cout << t2 << " UTC is " << t3 << " New York time\n\n";
|
std::cout << t2 << " UTC is " << t3 << " New York time\n\n";
|
||||||
|
|
||||||
auto t4 = day_point(2002_y/may/31) + 20h + 0s; // 4 hours b/f midnight NY time
|
// 4 hours b/f midnight NY time
|
||||||
|
auto t4 = day_point(2002_y/may/31) + 20h + 0s;
|
||||||
std::cout << "UTC <--> New York while DST is active (4 hours)\n";
|
std::cout << "UTC <--> New York while DST is active (4 hours)\n";
|
||||||
auto t5 = zone->to_sys(t4);
|
auto t5 = zone->to_sys(t4);
|
||||||
std::cout << t4 << " in New York is " << t5 << " UTC time\n";
|
std::cout << t4 << " in New York is " << t5 << " UTC time\n";
|
||||||
|
Reference in New Issue
Block a user