C
C#

help

Need help getting cest timezone

BBlackBull10/10/2022
i currently have this code
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));

while (await timer.WaitForNextTickAsync())
{
DateTime dateNow = DateTime.Now;
label5.Text = "The date and time are {0} UTC."+
TimeZoneInfo.ConvertTimeToUtc(dateNow);
string time = DateTime.Now.ToString("hh:mm");
}
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));

while (await timer.WaitForNextTickAsync())
{
DateTime dateNow = DateTime.Now;
label5.Text = "The date and time are {0} UTC."+
TimeZoneInfo.ConvertTimeToUtc(dateNow);
string time = DateTime.Now.ToString("hh:mm");
}
but this gets the time in utc i want to get the time cest who can help me out
Eero10/10/2022
looking online, it seems you're forced to just do DateTime.UtcNow.AddHours(2)
BBlackBull10/10/2022
aah okey ill try that thanks that worked !

Looking for more? Join the community!