You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tested both scenarios in C# and they both returned UTC datetime:
using (var context = new ClientContext(list_url))
{
var securePassword = new SecureString();
foreach (char c in SharepointPassword)
securePassword.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials(SharepointLogin, securePassword);
int sid = 29;
List targetList = context.Web.Lists.GetByTitle(list_title);
ListItem targetListItem = targetList.GetItemById(sid);
context.Load(targetListItem);
context.ExecuteQuery();
Console.WriteLine("Retrieved item is: {0}", targetListItem["my_date"]);
CamlQuery query = new CamlQuery();
query.ViewXml =
"<View>" +
" <Query>" +
" <Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + sid + "</Value></Eq></Where>" +
" </Query>" +
"</View>";
ListItemCollection collListItem = targetList.GetItems(query);
context.Load(collListItem);
context.ExecuteQuery();
foreach (ListItem myListItem in collListItem)
Console.WriteLine("Retrieved item is: {0}", myListItem["my_date"]);
}
Please advice. Thank you.
The text was updated successfully, but these errors were encountered:
kevinlaucw
changed the title
getItemById returns UTC datetime instead of user local datetime
Camlquery returns user local datetime instead of UTC datetime
Nov 15, 2022
Hi,
Camlquery returns user local datetime instead of UTC datetime when retrieving a datetime (date only format) field from SharePoint.
SharePoint field name: my_date
Date and Time format: Date only
PHP 8.1.10
Camlquery returns user local datetime instead of UTC datetime
getItemById returns UTC datetime
I have tested both scenarios in C# and they both returned UTC datetime:
Please advice. Thank you.
The text was updated successfully, but these errors were encountered: