0

I am working on a SharePoint online site collection which have this regional settings:-

enter image description here

And i have a SharePoint column of type Date/Time, now inside SharePoint list view the date/time will be show as follow:-

enter image description here

which respect the site regional settings. now for the above site column >> i have a managed property and when i am showing this manage property inside the PnP Modern Search Result web part i will get the value based on UTC, as follow: -

enter image description here

so how i can show the date/time inside my Search Result to be equal to what is shown inside the list view?

Here is how i am rendering the column value inside the Search Result web part settings (resource.fields.RefinableDate01):-

enter image description here

EDIT

I tired the solution mentioned in this link @ https://spdcp.com/2019/12/21/local-time-zones-for-pnp-modern-search-web-part/.... Where i tried this formula:-

{{ getDate (getDate (slot item @root.slots.PUETA "YYYY-MM-DDTHH:mm:ss.0000000\Z") "ddd, MMM DD h:mm a" 3 }}

And I defined 3 to get the time zone of the current web, as per the documentation:-

enter image description here

but still there are differences, here are the actual date/time inside the list view:-

enter image description here

and here is how they are shown using the above expression/formula inside the PnP Modern search web part:-

enter image description here

so still there are those differences: -

21 August 2024 11 PM >>>>>>>> 22 August 2024 1 am 21 August 2023 10 PM >>>>>>>> 22 August 2023 12 am

so the gap get minimized, but still there are 2 hours differences .. any advice? can this be fixed?

1 Answer 1

1

When we fetch the values of any DateTime fields within a SharePoint list or library, the values are returned in UTC format, as they are stored in UTC format internally. Within an webpart it just displays the UTC time.

Unfortunately, this behavior is by design and it cannot be changed.

1
  • thanks for the reply, can you check my edit to the original question?, i provided more details about a solution i am trying to use, it minimized the gap in time but still there is 2 hours differences. can you check please? Thanks Commented Aug 23 at 8:31

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.