mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-05 13:44:26 +02:00
Updated Boost datetime Examples Translated (markdown)
@@ -387,14 +387,13 @@ main()
|
||||
```
|
||||
<a name="Local_to_UTC_Conversion"></a>
|
||||
### Local to UTC Conversion
|
||||
```c++
|
||||
#include "tz.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "date.h"
|
||||
#include "tz.h"
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
int
|
||||
main()
|
||||
{
|
||||
using namespace std::chrono;
|
||||
using namespace date;
|
||||
auto zone = current_zone();
|
||||
@@ -403,7 +402,7 @@ main()
|
||||
std::cout << "UTC <--> Zone base on current setting\n";
|
||||
std::cout << t11 << " is " << t10 << " UTC time\n";
|
||||
auto td = t11.get_local_time().time_since_epoch() - t10.time_since_epoch();
|
||||
std::cout << "A difference of: " << make_time(td) << '\n';
|
||||
std::cout << "A difference of: " << format("%T\n", td);
|
||||
|
||||
// eastern timezone is utc-5
|
||||
zone = locate_zone("America/New_York");
|
||||
@@ -429,8 +428,8 @@ main()
|
||||
std::cout << "UTC <--> Arizona (7 hours)\n";
|
||||
auto t8 = zone->to_sys(t7);
|
||||
std::cout << t7 << " in Arizona is " << t8 << " UTC time\n";
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
<a name="Time_Periods"></a>
|
||||
### Time Periods
|
||||
|
||||
|
Reference in New Issue
Block a user