How to get Server Actual time......

Posted by sourabhghosh49-13964 under ASP.NET on 4/11/2012 | Points: 10 | Views : 10113 | Status : [Member] | Replies : 8
Can any body tell me how to get server's time and date in asp.net.

Means not system datetime .....|||
Thanks

sourabh


Responses

Posted by: Kavi.Sirius on: 4/11/2012 [Member] Starter | Points: 25

Up
0
Down
hi,

This is the code to retrieve the server time in asp.net,

DateTime dt = new DateTime();
dt = DateTime.Now;


Regards,
kavi.n

Regards
Kavi.n

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/11/2012 [Member] Silver | Points: 25

Up
0
Down
getting the time from the server by writing this code at the beginning of the code and uploading it to the server.
This is very important or else it will give the local machine time.

<script runat="server">
sub page_load
textbox1.text = datetime.now()
end sub
</script>

The textbox1.text is the the textbox in which the time will be displayed.


Regards,
Singaravel M

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: sourabhghosh49-13964 on: 4/11/2012 [Member] Starter | Points: 25

Up
0
Down
these are the code for retrieving system's date..

i want date synchronized by server..thanks

sourabh

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/11/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi

Refer My Code:

http://www.dotnetfunda.com/codes/code2223-getcurrent-date-and-time-in-textbox.aspx

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/11/2012 [Member] Bronze | Points: 25

Up
0
Down
Refer This

http://asp.net.bigresource.com/SQL-server-How-to-Synchronize-offline-online-database-DkANT5rzy.html

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajni.Shekhar on: 4/11/2012 [Member] Bronze | Points: 25

Up
0
Down
do you want to get web server's date and time or database server date and time?

DateTime dt = new DateTime();
dt = DateTime.Now;

this will give you web server datetime.

Thanks,
Rajni Shekhar

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/11/2012 [Member] Starter | Points: 25

Up
0
Down
hi,
check this link.

http://www.dotnetspider.com/forum/203401-How-get-server-time-asp-net.aspx

Thanks & Regards
Hari

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 4/12/2012 [Member] Bronze | Points: 25

Up
0
Down
Sourabh.Ghosh49@Gmail.Com

Have you Referd

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

sourabhghosh49-13964, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response