Click to See Complete Forum and Search --> : Get Client's System Date


wackoyacky
04-19-2007, 02:22 AM
Hi All,

I'm currently developing an applications that will be used in different countries, my problem is how would I be able to determine the client's system date and time. If the date field is an entry, then it is not a problem, but my concern was for those field that are auto updated by the system let's say a "ModifiedDate" column.

I know by using .Now() would return me the web servers datetime, if I do this in SQL database, GETDATE() would return the database server's datetime instead.

Thanks in advance.

PeOfEo
04-19-2007, 11:17 AM
Easiest way would be to use javascript to get that and then pass it back to the server through a hidden input. Another option is give the user a js cookie, then pick that cookie up the next time code executes on the server.

wackoyacky
04-20-2007, 11:35 AM
Thanks for the input.

Another option that I can think of is to know the country of origin of the client, then from the web server datetime, I'll just compute the time difference for that specific country. Though I don't know how to do it as of the moment, so your option would be easier for me to do.

Thanks.

PeOfEo
04-20-2007, 11:42 AM
Well, and country gets real tricky because you need to derive that from the ip/hostname, and for some areas the geography can be a little bit off. If you were gonna use country the best bet would be to just ask the user where they are, and then you'd have to prompt them from a time zone too.

wackoyacky
04-20-2007, 11:46 AM
Luckily is not as complicated as that, because the users are already determined before they can use the application, and each user has his own country of origin already set upon creation of their account.

I'll give both options a shot :) If you still have other ideas in mind please do let me know, I'll really appreciate it.

Thanks!

Ribeyed
04-21-2007, 04:40 PM
Hi,
just use the correct .net class for the task:

System.Globalization.CultureInfo

wackoyacky
04-23-2007, 09:10 PM
This would be another option. Thanks!