This worked for me.
public static void ConvertUtcToSPRegionalSetting()
{
string sitrUrl = "http://abc.sharePoint.com/sites/AZV";
using (var context = new ClientContext(sitrUrl))
{
Microsoft.SharePoint.Client.TimeZone sharePointTimeZone = context.Web.RegionalSettings.TimeZone;
context.Load(sharePointTimeZone);
context.ExecuteQuery();
var fixedTimeZoneName = sharePointTimeZone.Description.Replace("and", "&");
//var timeZoneInfo = TimeZoneInfo.Local;
var easternZone = TimeZoneInfo.GetSystemTimeZones();
var TimeZoneID = "";
foreach (var z in easternZone)
{
if (z.DisplayName == fixedTimeZoneName)
{
TimeZoneID = z.Id;
break;
}
}
var myTimeZone = TimeZoneInfo.FindSystemTimeZoneById(TimeZoneID);
//Destination List
List oList = context.Web.Lists.GetByTitle("TestAuthor");
var listItems = oList.GetItems(CamlQuery.CreateAllItemsQuery());
context.Load(listItems,
items => items.Include(
item => item["ReportDate"]
));
context.ExecuteQuery();
foreach (ListItem item in listItems)
{
DateTime reportDate = (DateTime)item["ReportDate"];
var ConvertedDateTime = TimeZoneInfo.ConvertTimeFromUtc(reportDate, myTimeZone);
Console.WriteLine(string.Format("Original Datetime: {0}-{1}, Converted TimeZone DateTime:{2}-{3}", reportDate.ToShortDateString(), reportDate.ToShortTimeString(), ConvertedDateTime.ToShortDateString(), ConvertedDateTime.ToShortTimeString()));
}
}
}
get_regionalSettings()
inside javascript while i am working on CSOM code which does not have such as method