DateTime.Now
performs a few steps:
- Get UTC time from the OS
- Get timezone info from the registry of the machine on which it is executing
- Use that timezone information to resolve UTC to local time (again, local to the executing machine)
If this returns Client time, how to get Server time and vice-versa?
If you are dealing with clients in multiple timezones, it's often useful to store all dates in UTC and then store the client's timezone for conversion purposes.
JavaScript can also be useful for resolving UTC dates to client time and/or for obtaining time in the web browser.
Geolocation (e.g. examining the user's IP) can also be used to make a guess as to the user's location/timezone, though it's not guaranteed to be accurate.