Wednesday, March 28, 2012

Web server time

can anyone please tell me how do i get the date/time of the web server hosting the website... i know the function Now() get the client side time.. but what if i wan the server-side time... please help...Have a look at this (http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock)
but that is in javascript.. what if my page language is in vb???
can i find out whether there is any code which will display the GMT of the client.. ex: my gmt is +8 so when my computer request from the server it should display GMT+8...
DateTime.Now does not give client time. It will give you the server time.

To get the time zone of the client, you need to use javascript.

var d = new Date();
alert(d.getTimezoneOffset());
sorry when it come to prgramming for time i am quite a noob..u mind give me the full syntax for DateTime.Now ??
u mind give me the full syntax for DateTime.Now ??

DateTime.Now

Yes, that is the syntax. To display it, you can use

DateTime.Now.ToString()

or

DateTime.Now.ToShortDateTimeString()

and other available methods which should be visible to you in the intellisense.

0 comments:

Post a Comment