I've run into a strange problem with SharePoint Online.

When updating or creating entries in a list using the Client Object Model, the modified date on the affected list item seems to be stored with the wrong timezone.

Our Office 365 server is at UTC -7 (I assume it's probably on Redmond time, even if it's not actually physically there), and I am at UTC +1. If I create a record using C# on the server, the modified date is stored with the current date and time at UTC -7. However, if I store a record from the client using JavaScript, the record is stored with my current time, but is also at UTC -7!


if current time        = 13:07 GMT
my local time          = 14:07 UTC +1
storing on the server  = 06:07 UTC -7
storing via the client = 14:07 UTC -7  (e.g. 8 hours in the future!)

I am not setting the modified date directly - I'm relying on SharePoint to track this information correctly.

My client script looks like this:

function addRow() {
    //Create a new record
    var context = SP.ClientContext.get_current();
    var extList = context.get_site().get_rootWeb().get_lists().getByTitle(options.listTitle);

    var itemCreateInfo = new SP.ListItemCreationInformation();
    var listItem = extList.addItem(itemCreateInfo);

    //Set the values
    listItem.set_item('Current', data.query.results.quote.LastTradePriceOnly);
    listItem.set_item('Title', 'results');

    listItem.set_item('TradeDate', tradeDate);
    listItem.set_item('TradeDateStamp', tradeDate.getTime());


        Function.createDelegate(this, addListItemSucceeded),
        Function.createDelegate(this, addListItemFailed)

    function addListItemSucceeded() {
        console.log('Row ' + data.query.count + ' added OK. New ID is ' + listItem.get_id());
    function addListItemFailed(sender, args) {
        console.log('Failed to add row ' + data.query.count + '. ' + args.get_message() + '\n' + args.get_stackTrace());

Am I doing something wrong? Or is this a bug with SharePoint Online?

Update: The problem occurs when I try to retrieve the value of the Modified date using the Server Object Model:

DateTime lastUpdateDate = DateTime.MinValue;

var web = SPContext.Current.Site.RootWeb;
SPList list = web.Lists[ListName];
SPListItemCollection items = list.GetItems();
foreach (SPListItem i in items)
    DateTime modified = (DateTime)i["Modified"];
    if (modified > lastUpdateDate)
        lastUpdateDate = modified;

// lastUpdateDate is in the future if a client in a timezone east of Redmond
// updated the data using the client object model

2 Answers 2


It might be a Localtime to UTC conversion issue. This normally happens when you have timezone differences from the server. Try converting your Localtime to UTC using the SPTimeZone object and then saving it.

  • So, this led me to the answer - there's a good explanation at stum.de/2010/06/10/…. It seems that SP assumes that all DateTime values in a list are specified in either the web's regional timezone, or UTC (depending on how you create your list) - and the server ignores the timezone of your value when you store it, even if your DateTime value is in another time zone. I don't really understand why SP would ignore the timezone when I save a DateTime value (since this information is easily available to it), but that's SP I guess..
    – Dexter
    Apr 18, 2012 at 12:27
  • 1
    Dexter, verified results. What makes matters worse is that, if the date column is created and configured as a 'date' column, not jus a 'datetime column', then it is stored as if it has a midnight date. Thus, when it is retrieved through COM, and the clients browser is set to have a timezone "to the left" of the sites timezone, the date column appears to one day off, when there really is only a 1 hour difference.
    – 1c1cle
    Mar 25, 2013 at 14:49

I had a similar issue since my SharePoint online regional settings were first to Pacific time zone. I then set to UTC+1 for Europe. I am using CSOM to save into SharePoint. And since I only set the date without time, I get the date saved as the day before at 23:00, as 1c1cle said, since SharePoint is saving date as UTC. But that is not a big issue, they are shown back as +1. And to avoid the time difference while saving, I first convert my original value to UTC, using ToUniversalTime() method https://msdn.microsoft.com/en-us/library/system.datetime.touniversaltime(v=vs.110).aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.