Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8527095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:27:33+00:00 2026-06-11T08:27:33+00:00

Weird bug, When inserting a SharePoint list item I set the date submitted to

  • 0

Weird bug,

When inserting a SharePoint list item I set the date submitted to DateTime.Now and it is working fine as when I check SharePoint I see the item inserted just fine with the correct date and all values.

oListItem["Date_x0020_Submitted"] = DateTime.Now;

But when I go to retrieve the exact same list item for some reason the date comes back as 4 hours into the future!!

    query.ViewXml = "<View><Query><OrderBy><FieldRef Name='Date_x0020_Submitted' Ascending='FALSE' /></OrderBy></Query><RowLimit>1</RowLimit></View>";
    SP.ListItemCollection issuesCollection = oList.GetItems(query);
    MyContext.Load(issuesCollection, (items => items.Include(item => item["ID"], item => item["Date_x0020_Submitted"])));

Just to reiterate, after inserting the item I can see it in the list with the correct exact date inserted, but when I retrieve it for some reason it is 4 hours into the future. For example in SharePoint it shows me 10:53, but when I retrieve it shows 2:53.

Does anyone know why this might be happening? It happens for every single item that I insert and retrieve.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T08:27:34+00:00Added an answer on June 11, 2026 at 8:27 am

    The time which you store is your local time (UTC-5:00, probably with DST).
    Is there any chance that the time returned by Sharepoint is returned as UTC time? Kind property of DateTime class tells what kind of time it is (this has changed through different versions of .NET framework):

    var kind = DateTime.Now.Kind;
    

    You can convert the returned time to local time and see if it matches:

    var localTime = utcTime.ToLocalTime();
    

    As you say that your time is given as a string (although I suspect that as that format doesn’t look like string), you can try to parse it:

      string fmt = "M/d/yyyy h:mm:ss tt"; // this is equivalent to format you have shown
      string stime = "9/14/2012 3:38:04 PM"; // your string here
      var time = DateTime.ParseExact(time, fmt, CultureInfo.InvariantCulture);
      var local = time.ToLocalTime(); // => 14.9.2012. 17:38:04 in my timezone
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just stumbled upon this weird bug with php's DateTime object... Check this out: <?php
i see a weird bug here.. i have a list view which is populated
I am having a weird bug when I set and get cookies after a
I encountered today a weird bug with an app I'm working on. The problem
I have this supper weird bug, where this method fails in IE9. What is
I've got a weird bug occurring in a compact database on a Vista deployment
I have a weird bug in Chrome which affects a page in Wordpress. I
I believe I have found a weird bug as follow: I want to delete
We just came across a weird bug in our application that uses the asp.net
I am busted with a weird bug in my app. It comes in levels

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.