Tried this Console.WriteLine(new DateTime(2017, 05, 23, 8, 00, 00, 0).ToUniversalTime() + " "+ DateTime.Now.ToUniversalTime()); Even this does not give expected result on Kudu Console, on Kudu Console: 5/23/2017 8:00:00 AM 6/7/2017 11:04:23 PM on Local Console: 5/23/2017 3:00:00 PM 6/7/2017 11:04:23 PM
The differences between your local and Azure Web App instance is that the default time zone in Azure Web App instances is UTC. According the result of your test, the time zone on your local is UTC+07:00. If you create a new instance of DateTime by year/month/day/hour/month/minute, it will use the default time zone of your system.
It is not recommended to save a datetime to a string with this format 'year/month/day/hour/month/minute'. It will lose the time zone information. If your code runs on a machine with different time zone, it will cause some issues.
If you did need to store the datetime information in a string, you could store the datetime information with a time zone symbol(ex. 2017, 05, 23, 8, 00, 00, 00 UTC+07:00). To get the datetime back from the string, we need to add the offset hours.
var dateTime = new DateTime(2017, 05, 23, 8, 00, 00, 0, DateTimeKind.Utc).AddHours(7);
Or you could convert datetime to GMC time before save it. After that, you could create a new instance of DateTime with a DateTimeKind parameter.
var dateTime = new DateTime(2017, 05, 23, 8, 00, 00, 0, DateTimeKind.Utc);