EntLib 3.1 显示本地时间方法

With this simple change in place, you can now change your TextFormatter templates to support local times. For example, I created a template that shows several timezones in different formats:

Timestamp: {timestamp}
Timestamp local: {timestamp(local)}
Timestamp F: {timestamp(F)}
Timestamp local:F {timestamp(local:F)}

Once the Logging Application Block does its magic over my log message, I get a nicely formatted text message that looks like this:

Timestamp: 1/23/2006 2:24:18 AM
Timestamp local: 1/22/2006 6:24:18 PM
Timestamp F: Monday, January 23, 2006 2:24:18 AM
Timestamp local:F Sunday, January 22, 2006 6:24:18 PM

Looks pretty useful to me. Again, sorry that we couldn't make it work that way after a fresh install, but don't be afraid to crack open the source code to make these kinds of changes - after all, that's the reason we give it to you!
http://blogs.msdn.com/tomholl/archive/2006/01/22/516055.aspx

posted @ 2008-02-29 16:35  nSibo  阅读(197)  评论(0编辑  收藏  举报