using System.Threading.Tasks;
static async Task Main(string[] args)
using (HttpClient client = new HttpClient())
string apiUrl = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam";
HttpResponseMessage response = await client.GetAsync(apiUrl);
if (response.IsSuccessStatusCode)
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
Console.WriteLine("Failed to retrieve the current time.");
Console.WriteLine("An error occurred: " + ex.Message);