在asp.net上网 [英] Get internet time in asp.net
本文介绍了在asp.net上网的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp.net中的文本框上显示互联网时间而不是服务器时间。???
How to get internet time display on text box in asp.net not server time .???
推荐答案
什么是''互联网时间'?这个问题毫无意义。要在服务器上获取时间,请使用在服务器上计算的值。要在客户端上获取时间,请使用Javascript 日期 [ ^ ]对象。然后,如果您愿意,可以将该值输入隐藏控件或AJAX调用以告知服务器客户端时间。
What is ''internet time'' ? This question makes no sense. To get the time on the server, use values calculated on the server. To get the time on the client, use the Javascript Date[^] object. You can then push that value in to a hidden control or an AJAX call to tell the server the client time, if you wish.
您好,
请参阅此链接
http://stackoverflow.com/questions/6435099/c-how-to-get-datetime-from-the-internet [ ^ ]
你必须得到它使用javascript,然后你就可以得到当地时间。
You have to get it with javascript, then you can get the local time.
var someMillisecondValue = 511111222127;
var date = new Date(someMillisecondValue);
var minute = date.getMinutes();
var hour = date.getHours();
var day = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
这篇关于在asp.net上网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文