![](/img/trans.png)
[英]How can I display the current date and time in my C# windows form application's text property?
[英]How can I get the remote server's date and time at the client side in my application in c#?
我在应用程序中为用户设置了截止时间,因此,我不想考虑当前的系统时间,而是希望考虑远程服务器计算机的时间,因此如何在c#中获取远程服务器的日期和时间。
在您的服务器上编写一个发送日期时间的请求处理程序。 没有更多细节,很难知道如何实现。
编写一个简单的Web服务,该服务在被调用时将返回时间戳(可能使用UTC或其他方式)。
[WebMethod]
public string ServerDateTime()
{
serverDate = DateTime.UtcNow;
return serverDate.ToString();
}
您甚至可能变得懒惰,并且拥有具有相同Web方法的标准asp.net页面。 示例: http : //softwaredevscott.spaces.live.com/blog/cns!1A9E939F7373F3B7!484.entry
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.