I have a great problem and I don’t know how to solve it
I have created a web application and host it in USA server , and the users who access this web application from Egypt
The problem that i’m using DateTime.Now method inside the application and this method return the time of USA server not the time of the machine that use it in Egypt
How can i solve this problem ? please help me as soon as you can
Thanks in Advance
Well, you could start off by using
DateTime.UtcNow, transferring that to the client, and then performing the relevant time zone conversions at the client. That’s usually a reasonable way of working – so long as you can do the processing at the client (e.g. in JavaScript).Alternatively, ask the user their time zone so you can serve pages which use the local time, using
TimeZoneInfo. Of course if you know all your users are in Egypt you could potentially just hard-code that.