C
C#2w 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
Pobiega2w ago
You normally do that by changing the TZ on your container/host. So how are you deploying this app?
i_umarov
i_umarov2w ago
Docker container. But I also want to test, debug locally
Pobiega
Pobiega2w 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_umarov2w 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