I need to save client machine time when he log in on my web application. For this I have 2 solution
- Using javascript
- Store the server time
System.DateTime.Now.ToUniversalTime();
and ask the user in which timezone he is in
TimeZoneInfo indTimeZone = TimeZoneInfo.Local;
return TimeZoneInfo.ConvertTimeFromUtc(date, TimeZoneInfo.Local);
What is the better solution to do this taks, using 1st one or 2nd one?
If there is any better solution then please give me.
To access the client’s time, you have to use javascript. All server-based solutions can’t access the client’s clock.
So, there is no better solution, sorry.