Return a converted date from UTC to local
Hi, I have UTC date in the database. Is there any possibility to shift the responsibility of changing the time to local time in the exported file? I cannot get the user's time zone in the backend application
Can you elaborate a little? What is the DateTimeKind of the DateTime values you're exporting and what kind of value do you expect in the exported Excel file?
I export DateTime objects with Kind=Unspecified or Kind=UTC (I would prefer the second one). In the exported file, I would like the client to get the dates in the local time zone.
For example, with an offset of + 2H, I have the date 2022-08-31 00: 00: 00.000Z in the system and I want the date 2022-08-31 02:00:00 in the exported file.
Similarly, when importing -> the client sets the date in the local time zone and I want to receive it in UTC but the ToUniversalTime() method will help here.
I think before exporting you need to map the DateTime values to local time using ToLocalTime().