java - Methods of getting a user's current client side date and time in different areas -


We have applications that use servers in central location, who have server time on their own, we have the whole world Covering users are every time we need to handle the prints of a page, or if we need to calculate that age (day) or something else that requires the customer's time, then we can send the customer to the wire Sending time from browser and In a date object in java and stored there with it there

Sometimes we do in JavaScript in favor of Javascript, if this is a unique case that does not need to be repeated, the wire only once It would be good to send and standardize one way of using it on the server. I was just thinking about using time since a variable was kept in session and the session was created.

I'm curious if someone else has acted on it and has to come through a clever way of dealing with it, I am sure that we are not the first people to deal with this small annoyance.

It is also possible that sending the client's date when necessary is really the best way to do this, which is relatively simple, which is more complex. I'm just leaning towards that. This would mean that I do not do anything else originally ... which I sometimes oppose doing this = D

Every time you want to save the customer's current time, which is necessary to make a request every time, which is not very expensive in computing time nor the bandwidth is in the IMO, Do not retrieve the client's time zone once and do not submit it to the session, and then use it Switch to it whenever the each server you need it, to calculate the time?

Using the time since the session makes it easier for me, even more cleaner.

You can retrieve timezone offset by using the client side:

  dateObj.getTimezoneOffset ()  

Gives the offset of the customer's time zone (for example, if your time zone is UTC + 10 (Australian Eastern Standard Time), then -600 will be returned)

See for more information.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -