I'm building an app with ASP.NET MVC. Currently, the users create records. I store the date/time the records were created in UTC time. When I display them to the user, I want to format them like February 8, 2015 at 9:30 pm (local time)
. How do I do that in my view? Currently, I have:
@(Model.CreatedOnUTC.ToLongDateString() + " at " + Model.CreatedOnUTC.ToShortTimeString())
However, this isn't quite right.First, its not converting to the user's local time. And second, the format isn't correct. I know the server is not guaranteed to know the user's time zone. Let's assume it does though.