Solved

Saving Date value to SharePoint Online list

  • 15 June 2021
  • 6 replies
  • 317 views

Hi,

I have an NWC form with a Date only field (Date of Birth) and using SharePoint Create an Item action to send its value to SharePoint. I'm directly mapping the list field to the form Date of Birth Variable. The list field is a Date Only field.

When the item is created in SharePoint the date value is always a day behind. i.e. when I select 01/06/2021 as the date in the NWC form, it shows up in the list as 31/05/2021.

I'm guessing this is because the Time Zone is coming into play. How do I set the date correctly in the workflow so the list item shows the same date as in the form.

The regional settings in both form and the list is set to UTC+08:00 Perth

 

Thanks!

icon

Best answer by Rizi 13 July 2021, 06:04

View original

6 replies

Userlevel 3
Badge +11
Hi Rizi,

I know you mentioned that the regional settings on the list are at UTC+8:00. Do you have the administrator level to check your personal regional settings as well as the SharePoint Tenant's overall settings? Perhaps those aren't aligned correctly. The following link steps through a couple of those settings.

https://www.spguides.com/sharepoint-online-regional-settings/

Jason

Hi Jason,


The form is set up so anyone can access it using it (public anonymous access). So my personal regional settings should not be an issue. But I've checked both mine and the account the data connection is using to connect to SharePoint online: Both have the correct regional settings (UTC+8:00). The Same for the Site collection the list is on and in the NWC Form settings.


The tenant regional settings should not affect at all correct? as it's been overridden by the Site COllection Regional settings?

Userlevel 5
Badge +13

@Rizi Date fields are always passed as a UTC date/time and SharePoint date only fields still have time component that is just hidden on the view. You can use a log to instance detail to see the time being passed. The screenshot below shows the UTC time as well it being converted both US and an Aus timezone using the convert date to string action.



It could be the users personal regional settings causing the issue(https://support.microsoft.com/en-us/office/change-your-personal-language-and-region-settings-caa1fccc-bcdb-42f3-9e5b-45957647ffd7). The other option is converting the date to a timezone and putting in a text field or using the add time to date if you can't resolve the regional setting.


 

Userlevel 2
Badge +5

Hi @Rizi ,


I was able to get this to work in my test environment by doing the following:



  1. First I checked the Create an item action to see if it would accept a text variable to set a date column in the list and it does. 😀

  2. Next, I manually inserted a date in the Create an item action to see what date format is required:

  3. Now that I knew what format is required, I added a Format date to string action to my workflow above the Create an item action and stored the formatted date in a text variable named txtDOB. This also allows me to specify a time zone. 

  4. Because the exact format option I needed wasn't available, I also added a Create a text string action to finalize the formatting:

  5. Finally, in my Create an item action, I inserted the txtDOB variable into the DOB date column field:

  6. The completed workflow looks like this:

    This corrected the date in my SharePoint Online list. Give it a try and see if it works for you.



Userlevel 3
Badge +11

I was also able to reproduce the issue.


 


One thing that worked for me was to change the date format of the Date and Time column in SharePoint to  Date & Time under the Additional Column Settings section.


 



 


I also configured the date control on the NWC form to turn off the Hide Time setting.



 


I think this way the date time format comes in from the NWC form with the full date and time based on when the date was selected then SharePoint can store it with the correct UTC value. Ultimately, you may need to ensure that you have the time designated with the date as it gets stored in SharePoint.

This was a Bug in NWC. Opened a Support Case with Nintex Support and they have applied a fix for it. All working as expected now.


 


Thank you for all your help

Reply