I have a computed date field in Solr that for certain items is off by 1 day.

enter image description here

The code is really simple:

public class SearchDateField : BaseContentComputedField
    public override object GetFieldValue(Item indexItem)
        var pageItem = indexItem.GlassCast<I_Date_Posted_Base>();
        return pageItem.Date_Posted

When debugging my code, my page has the value for Date Posted that I expect (9/29/2019). But when I access the computed search date field in my search results, the date is 9/30/2019, and when I look in Solr the date is 9/30:

enter image description here

I tried the following things:

Creating a new UTC date from the Sitecore date:

var date = pageItem.Date_Posted;
var UtcDate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0, DateTimeKind.Utc);
return UtcDate;

Setting the date to ServerTime:

return Sitecore.DateUtil.ToServerTime(pageItem.DatePosted)

but I can't get the date in Solr to be correct.

  • what version of sitecore are you using? I had this issue in version 8.1 for which SC support provided me a hotfix.
    – Mikeyp
    Dec 16, 2019 at 20:24
  • @erica-stockwell-alpert if the below helped you could you please marked it as answer. Feb 24, 2020 at 1:47
  • @erica-stockwell-alpert thank you Feb 25, 2020 at 22:28

1 Answer 1


I think in your Sitecore configuration you need to set below two things to as per your requirement(The timezone which you want) of time required and then hope that will resolve this issue.

<setting name="ServerTimeZone" value="Value for your timezone"/>

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />


  1. Make a patch file for this.
  2. If you are using Azure PaaS then you may also need to add below Application setting in your configuration of App service.
  3. Use this link for Timezone values.
  4. You need to use Name of Time Zone column from above link to get the values of timezone.

WEBSITE_TIME_ZONE =”Value for your timezone”

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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