Reputation: 1704
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 from the server. Can anyone please help me how can i fix this problem.
Thanks in advance...
Upvotes: 1
Views: 791
Reputation: 1064064
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).
Upvotes: 4
Reputation: 661
What are u using the date and time for? If just for displaying, you can take a look at javascript
Upvotes: 0