I am coding a MVC 5 internet application and am wanting to convert a DateTime
to be displayed as a LocalTime
where I have the language. This is for an Azure
website.
Here is my code:
DateTime dateTimeUtcNow = DateTime.UtcNow;
DateTime convertedDate = DateTime.SpecifyKind(dateTimeUtcNow, DateTimeKind.Utc);
DateTime dateTimeLocalTime = convertedDate.ToLocalTime();
return dateTimeLocalTime.ToString(new CultureInfo("en-NZ"));
The output from the above code is the exact same output as if I return the DateTime
in UTC
with no language culture specified.
How can I convert a DateTime
in UTC
for a local time where I have the culture language?
Thanks in advance.