from title it appears a stupid question :) i know but i have a silverlight application that needs to send datetime to a 3rdparty web method and based on datetime populate some client side controls... now i know how to get datetime from client but problem is that client time could be wrong........ one method is to use a webservice to get datetime any other idea?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you need the reliability of the server's time, then yeah -- a web service would suffice. I ran into a limitation with Silverlight recently that only a web service (WCF or otherwise) would solve. I chose an ordinary .NET web service for my scenario and when it was all said and done it worked like a charm.
回答2:
Be more specific about your scenario. What do you mean by 'client time could be wrong'?
If you mean that client time could be different than server time because of world time difference (e.g. client accessed from USA while server is in UK) than you have to make sure to convert your time to Universal Time by calling DateTime.ToUniversalTime()
before sending it.
标签:
silverlight-2.0