C
C#3mo ago
i_umarov

How in ASP.NET Web API application .NET 8, Set server time in UTC?

I have an Web API application, I would like to operate with utc timezone in application
4 Replies
Pobiega
Pobiega3mo ago
You normally do that by changing the TZ on your container/host. So how are you deploying this app?
i_umarov
i_umarovOP3mo ago
Docker container. But I also want to test, debug locally
Pobiega
Pobiega3mo ago
Well, consider using DateTimeOffset.UtcNow and such. You can't set the timezone for just .NET, it uses your servers timezone even better, use a timeprovider and the usual recommendation, if proper time handling is crucial to your app, consider using NodaTime or similar
i_umarov
i_umarovOP3mo ago
With TZ, I make sure that it will be in UTC, But I also need to test/debug locally.
Want results from more Discord servers?
Add your server