Skino2412 Posted June 11, 2021 Report 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
Paul Henty Posted June 11, 2021 Report 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
Skino2412 Posted June 12, 2021 Author Report Posted June 12, 2021 Thank you very much. I will try but I think this is beyond my ability as a hobby programmer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now