开发者

How do I set DateTimes universally to local time in view engine?

开发者 https://www.devze.com 2023-03-01 22:48 出处:网络
I 开发者_StackOverflow社区am storing DateTimes in my db using UniversalTime. In my views/controllers, I was hoping to convert them to Local Time. Is there a way to do this other than calling .ToLocalT

I 开发者_StackOverflow社区am storing DateTimes in my db using UniversalTime. In my views/controllers, I was hoping to convert them to Local Time. Is there a way to do this other than calling .ToLocalTime() in my controller on each individual DateTime?


You could write a custom display template for DateTime.

@model System.DateTime

@Model.ToLocalTime()
0

精彩评论

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