mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-04 13:14:26 +02:00
Updated Examples and Recipes (markdown)
@@ -104,7 +104,7 @@ main()
|
||||
std::cout << date::format("%T\n", sy.get_local_time() - la.get_local_time());
|
||||
}
|
||||
```
|
||||
Let's say you want to find out how many hours ahead Sydney is from LA (now). First get the current UTC time. Then create a `zoned_time` for both "America/Los_Angeles" and "Australia/Sydney" using that current UTC time. Then subtract their `local_time`s. `make_time` is a handy formatting tool for printing out that duration:
|
||||
Let's say you want to find out how many hours ahead Sydney is from LA (now). First get the current UTC time. Then create a `zoned_time` for both "America/Los_Angeles" and "Australia/Sydney" using that current UTC time. Then subtract their `local_time`s. `format` is a handy formatting tool for printing out that duration:
|
||||
|
||||
17:00:00.000000
|
||||
|
||||
|
Reference in New Issue
Block a user