Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a converted date from UTC to local #215

Open
emkoos opened this issue Aug 31, 2022 · 3 comments
Open

Return a converted date from UTC to local #215

emkoos opened this issue Aug 31, 2022 · 3 comments

Comments

@emkoos
Copy link

emkoos commented Aug 31, 2022

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

@mganss
Copy link
Owner

mganss commented Aug 31, 2022

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?

@emkoos
Copy link
Author

emkoos commented Sep 1, 2022

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.

@mganss
Copy link
Owner

mganss commented Sep 1, 2022

I think before exporting you need to map the DateTime values to local time using ToLocalTime().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants