开发者

Time and date generation webservice

开发者 https://www.devze.com 2022-12-11 11:52 出处:网络
Can 开发者_JAVA技巧any one give me the code of web service (.asmx) for generating Time and date of a city, if I enter the name of a city in any part of the word..

Can 开发者_JAVA技巧any one give me the code of web service (.asmx) for generating Time and date of a city, if I enter the name of a city in any part of the word..

Means in the web service consuming side.. say a Windows application I am reading the name of the city and I am sending it in to web service


I doubt that anyone would just hand you the code for it, but you can write it yourself.

The hardest part is getting a list of all cities and what time zone they are in. Once you have identified the city and got it's time zone, the rest is easy:

DateTimeOffset time = new DateTimeOffset(DateTime.UtcNow, TimeSpan.Zero);
time = time.ToOffset(offsetOfTheCity);
0

精彩评论

暂无评论...
验证码 换一张
取 消