Hi,
I'm using mvc version 13.0.
datetime fields are not being converted to the time zone defined in host settings.
added in PreInitialize for CoreModule: Clock.Provider = ClockProviders.Utc;
the values are correctly saved in UTC in the database, but when retrieved in a query and displayed in HTML they continue to show in UTC
the converted value should be 12/01/2024 09:02:24
5 Answer(s)
-
0
Hi @ricardo
Do you use MVC UI or Angular UI ?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I'm using mvc (Asp.Net Zero version 13.0)
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @ricardo
For MVC side, only tables are automatically handled. If you are showing this date in a cshtml file, you will get the UTC value and you need to convert it to user's timezone using
ITimeZoneConverterand then display it.Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @ismcagdas,
Thanks for the feedback.
And in the service layer, the date will always be returned in UTC when received from the database? Or should it be converted to the logged in user's time zone?
I'm using a DevExpress grid, how could I do this date conversion?
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi,
- Yes, it will be retrieved as UTC from database.
- In that case, you can use a custom render funciton (I guess DevExpress grid supports it) and then use https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.Web.Resources/Abp/Framework/scripts/abp.js#L905 to convert date to current user's timezone.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)



