Getting Internet Time


Another useful tool for anyone looking to do any kind of timed logging across multiple computers in multiple continents, and you need a consistent timing system.

For example, lets say you have multiple corp members that will be depositing information into a discord server occasionally…

Anyway, this method will return the current DateTime directly from Google’s servers, and will deliver that information in the GMT timezone.

public static DateTime GetInternetTime()
            using (var response =
                //string todaysDates =  response.Headers["date"];
                return DateTime.ParseExact(response.Headers["date"],
                    "ddd, dd MMM yyyy HH:mm:ss 'GMT'",
        catch (WebException e)
            return DateTime.Now; //In case something goes wrong.