asp.net mvc - MVC - UTC date to LocalTime -
we have mvc project , need display utc date converted users local time. in model passing utc date , in view trying following:
<%: html.displayfor(m=> m.somedate.tolocaltime()) %>
this throws exception. can point me in correct direction on how convert utc date local datetime display @ customer end. storing dates utc , @ display time these dates need converted local machine equivalent.
you need store users timezone server side , use (although should done in controller, not view):
@timezoneinfo.converttimefromutc(model.createdon, timezoneinfo.findsystemtimezonebyid("e. australia standard time"))
Comments
Post a Comment