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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -