How do you find out the local time of the user browsing your website in ASP.NET?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Create a hidden input control to get the value back at the server on the next page postback. It will need to be populated it in the onload event for the page with the value of a new Date object created in JavaScript. You will want to create a JavaScript function to do this and add that to the page using RegisterClientScriptBlock.
Something like this;
Then create a call to the function passing the ClientId of the hidden input and then add that piece of script to the page using RegisterStartupScript so that it runs on page load.