Skino2412 Posted June 11, 2021 Report Share Posted June 11, 2021 I would like to display the local time of the departure and destination airports in a small program. Can I somehow determine this via offsets? Peter Quote Link to comment Share on other sites More sharing options...
Paul Henty Posted June 11, 2021 Report Share Posted June 11, 2021 Not via offsets. The best you can do is the local time at the players location. If you use the Airports Database built into the DLL you can get the Lon/Lat of the airport. With this you can use a NuGet package called GeoTimeZone to get the time zone at that location. https://github.com/mattjohnsonpint/GeoTimeZone You can then use another NuGet package called TimeZoneConverter to convert this to the normal .NET TimeZoneInfo class. https://github.com/mattjohnsonpint/TimeZoneConverter You can then use that to work out the local time from the UTC Simulator time from the DLL: (FSUIPCConnection.UTCDateTime). Something like this: string timeZoneIANA = TimeZoneLookup.GetTimeZone(apLat, apLon).Result; TimeZoneInfo tzInfo = TZConvert.GetTimeZoneInfo(timeZoneIANA); DateTime airportLocalTime = TimeZoneInfo.ConvertTimeFromUtc(FSUIPCConnection.UTCDateTime, tzInfo); Paul Quote Link to comment Share on other sites More sharing options...
Skino2412 Posted June 12, 2021 Author Report Share Posted June 12, 2021 Thank you very much. I will try but I think this is beyond my ability as a hobby programmer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.