You can follow below approach:
Step 1:
You can store UTC time in database. If you are using SQL then you can use GETUTCDATE()
to get UTC date.
Step 2
Please use Javascript to set a cookie, storing the browser timezone. (You can use scripts like jsTimeZoneDetect to get timezone name)
Step 3
Backend C# code:
Pull timezone from cookie.
Get the inserted utcTime from database and store in local variable(utcTime
is the local variable name i used).
Use below mentioned code to convert UTC time to local time.
TimeZoneInfo tzoneinfo = TimeZoneInfo.FindSystemTimeZoneById("browser timezone name");
DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, tzoneinfo);
Finally localtime is the end result. :)
Hope this will help you
Thank you