开发者

Localizing dates and times automatically in Silverlight

This is more of a question about best pattern and practice than asking about any one particular method. We have app that is heavily reliant on dates and times and is hosted in the US. Sometimes it needs to perform actions based on those values, like emailing out reminders and expiring "single-use" session tokens.

However there are clients around the globe that need to access this app and have the dates and times 开发者_如何学Pythondisplay relative to their local time.

Clearly the solution should be to store the dates on the server side in a single time zone (UTC?) and then convert them back and forth from the local time settings of the user.

We are using silverlight 4 on the client and the ria services 1.0 stack over linq2sql on the server side. I am hoping someone knows if there is a way to automate this localization of date and time as much as possible and if so, what is the pattern to use for this.

Ideally we don't want to have to do a DateTime.ToLocalTime() every time we need to use a date. This has to be a common situation.

Is there a way to automatically shift dates and times into the client's local time zone on SL4?


One thing that occurs to me as a way to solve the problem is to use a ValueConverter, but you're right, there's probably a better way (since this would require adding that logic to every place it displays in your application.

I'd be kinda nice if there were some option on the client-side proxy RIA services generates that'd let you turn something like that on.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜