无论客户日期时间如何,都在asp.net网页中显示服务器日期时间 [英] show server date time in asp.net webpage irrespective of client date time

查看:71
本文介绍了无论客户日期时间如何,都在asp.net网页中显示服务器日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道是否有办法即使本地系统日期时间更改为其他某个日期时间,也会显示日期时间值网站的页面不应该改变它应该运行和显示。



例如:日期值是12月12日,2015年10:30:00在服务器系统中日期时间在本地系统中更改为2015年1月1日09:00:00 PM,并且一旦点击刷新网页中的值,应显示2015年12月12日上午10:30:00



手段应该只在网页上显示服务器当前日期时间



请建议,这是可能的



提前致谢

Hi,

I wanted to know is there a way where even when local system date time is changed to some other date time, the date time value displayed in page of website should not change and it should be running and showing.

For example: date value is dec 12, 2015 10:30:00 AM in server if system date time changes to dec 1, 2015 09:00:00 PM in local system and once clicked on refresh the value in webpage should show dec 12, 2015 10:30:00 AM

Means should show only server current date time in web page

please suggest, is this possible

Thanks in advance

推荐答案

是的,只需使用C#代码将当前时间放在标签中,例如。



Yes, just use C# code to put the current time in a label, for example.

lblTime.Text = DateTime.Now;





当然赢了除非您刷新页面或在JavaScript中使用setTimeout来调用服务器,否则不会更新以一定间隔获得时间。



Of course it won't update unless you refresh the page or if you use setTimeout in JavaScript to call the server to get the time at an interval.


这篇关于无论客户日期时间如何,都在asp.net网页中显示服务器日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆