1

I'm using Sitecore 10.

Values stored in sitecore are always stored in UTC, is there a way to show the values that appear in XProfile for a contact (i.e. Birthdate) in server time instead of UTC?

Edit: as mentioned in the answer below, I checked the js file found at \sitecore\shell\client\Applications\ExperienceProfile\Common\DataProviderHelper.js

However, it seems that sitecore is ignoring the timezoneoffset,

In my current case I have a datetime value stored in XConnect at a certain date eg: 13/4/2021 22:00 PM UTC time, and my timezoneoffset using the default sitecore code is 120 minutes, so in my localtimezone, the date should appear in xprofile card as 14/4/2021 12:00 AM, however, the date that appears in xprofile contact card is still the date in UTC,

I have tried entering any other numeric values rather than Date.getTimezoneOffset() , like xhr.setRequestHeader("X-SC-TimezoneOffset", 24 * 60 * (-1)); or xhr.setRequestHeader("X-SC-TimezoneOffset", 60 * (-1)); and the javascript file reflects the changes in console correctly, however the date that appears still remains in UTC rather than the Localtimezone date,

any idea why this is happening? I even checked the release notes for sitecore 10, and supposedly this issue is fixed (Where birthdate in xconnect appears in localtime rather than utc) but that's not the case, I checked this on multiple environments and it's happening on all of them

release notes link: https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/100/Sitecore%20Experience%20Platform%20100/Release%20Notes

Experience Profile ​The Birthdate value is converted to the local timezone.​​​ CS0107007 137803

2

In Experience Profile, DateTime values rendered in different views are formatted in their result formatters using the FormatDateTime() method defined in the Sitecore.Cintel.Client.Transformers.TimeConverter class.

This method converts the stored datetime value in UTC to a specific format in the user's timezone. This method relies on the timezone offset set dynamically on the client browser of the user accessing Experience Profile via javascript and submitted to the Experience Profile report API with the X-SC-TimezoneOffset request header (value in minutes).

If you really want to override this default behavior and enforce a specific timezone offset in the conversion, you can edit the logic to set the value of the X-SC-TimezoneOffset request header in the javascript code of the DataProviderHelper.js file in \sitecore\shell\client\Applications\ExperienceProfile\Common folder and replace the new Date().getTimezoneOffset() function with a static value. The default logic is the following one:

xhr.setRequestHeader("X-SC-TimezoneOffset", new Date().getTimezoneOffset() * (-1));
1
  • thanks for your answer, I tried following it though and the timezone offset didn't work, for some reason sitecore seems to ignore the timeoffset, in my current case I have a value stored in XConnect at a certain date eg: 13/4/2021 22:00 PM UTC time, and my timezoneoffset using the default sitecore code is 120 minutes, so in my localtimezone, the date should appear in xprofile card as 14/4/2021 12:00 AM, however, the date that appears in xprofile contact card is still the date in UTC, I have tried entering any other numeric values rather than getTimezoneOffset() but sitecore ignores them all Apr 13 at 10:58

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.