1

Recently I was creating a custom action for creating custom bucket rules, and I followed the instructions from this link. Everything went well but when I sync the bucketed folder, then on the basis of the date field it should create the folder structure but, the structure it is creating is one day before the provided date, for example if I pass the date 8/4/2017 the folder structure it is creating is based on date 8/3/2017

I check the date field, when I checked the raw values, I am getting 1 day before.

  • It looks your server is in a different culture, did you try by adding you current culture as CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US"); ruleContext.ResolvedPath = date.ToString(format, culture); please try this. – Mahendra Shekhawat Aug 1 at 8:08
  • I debuged the code and i am using this culture only – Rohan Bhateja Aug 1 at 8:12
  • in your debug what value you are getting in ResolvedPath? – Mahendra Shekhawat Aug 1 at 8:48
  • When you select a date on any date field. Is the raw value ok or not? If not, this is a timezone issue. Do you have anything set on ServerTimeZone setting? – josedbaez Aug 1 at 9:01
  • earlier there was no servertimezone , so i set that to IST then it is working now – Rohan Bhateja Aug 1 at 16:22
1

Set the setting <setting name="ServerTimeZone" value="" /> to match the desired timezone.

The Server Time Zone setting in the web.config file specifies the server time zone that is used by the server to convert UTC time to local time

Source: https://doc.sitecore.com/developers/90/sitecore-experience-management/en/settings-supporting-utc-implementation.html

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.