I have problem when I have datatime in json object it will convert it to UTC time zone in C# dateTime just want to ask how to keep local time?can I set time zone property in w
You can change your serializer settings to use the JSON.net serializer :
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings =
new JsonSerializerSettings
{
DateFormatHandling = DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = DateTimeZoneHandling.Unspecified,
};
There is also various date format you can choose from : DateTimeZoneHandling
///
/// Specifies how to treat the time value when converting between string and public enum DateTimeZoneHandling { ///. /// /// Treat as local time. If the Local = 0, ///object represents a Coordinated Universal Time (UTC), it is converted to the local time. /// /// Treat as a UTC. If the Utc = 1, ///object represents a local time, it is converted to a UTC. /// /// Treat as a local time if a Unspecified = 2, ///is being converted to a string. /// If a string is being converted to , convert to a local time if a time zone is specified. /// /// Time zone information should be preserved when converting. /// RoundtripKind = 3 }