Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clients local time

Status
Not open for further replies.

blar9

Programmer
Mar 12, 2007
39
US
I have a site and I need to pass in the clients date and time I am using the Now() function but when I display it on the screen it is giving me the servers time. Is there a way I can get the users local time????

Thanks!
 
I think you need to get that from the client side. Maybe using javascript to put the time into a hidden input, that can pass it to the server?

What do you need to get the local time for, that will probably have an effect on what you need to do.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
DateTime.UtcNow.ToString will give you the UTC date and time, if this helps
 
I tried solving this problem but cant get it right through the server. I even wrote a time region convertor but it was too buggy. Thus I use javascript with a hidden textbox.
Works great.
The way it work is, java gets time/date from user computer. Puts it into the hidden textbox.
Since the hidden textbox is a server control, now asp.net can grab it and put it into a string variable or something.

Read this turtorial

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top