Getting details of local machine's date and time
I am developing a website, in order do some operations i want to take the local date & time from the local machine. Apart from the server date and time. i want the user's system date & time who ever accessing my website 开发者_C百科from the server. Can anyone please help me how can i fix this problem.
Thanks in advance...
That isn't available on the http-request, but if javascript is enabled, it is available there via Date.getTimezoneOffset()
. You may also want to compare the time in javascript to the server-time (which you could send down in the response as milliseconds since Jan 1 1970) to get a more accurate delta to the server.
You can of course use javascript to populate a hidden form-field so your server can know the time, but that excludes the first request. IMO, it is simpler to just handle the time offsets at the UI.
Note also that you can't do much if javascript is disabled (except maybe a drop-down of possible offsets to choose from).
What are u using the date and time for? If just for displaying, you can take a look at javascript
精彩评论