cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
dgullo
Nintex Newbie

convert string date to date

Jump to solution

Hello,

Im trying to convert a string to a date. But the Workflow give me an conversion error.

The Value doesn't match with the Date Format.

Can someone tell me whats wrong with this convert action?

snippet.JPG

Best Regards

Reply
5 Replies
emha
Nintex Newbie

Re: convert string date to date

Jump to solution

I would say the problem is with date delimiter.

format string says what is the sequence of single date parts and where to expect date delimiter. however it doesn't says date delimiter is slash. date delimiter in input string is expected to be according your regional settings.

so if you are sure your input string will always use slash as date delimiter you have to configure that by respective culture.

eg.

Reply
dgullo
Nintex Newbie

Re: convert string date to date

Jump to solution

Hello Marian,

Thanks! Now it works.

Best Regards

0 Kudos
Reply
marekan
Nintex Newbie

Re: convert string date to date

Jump to solution

Hello Marian,

I would have a question related to this.

I call the web service to get list items and one of the returned fields is datetime. This returns for example 

2018-10-15T10:00:00Z

I now need to add x hours to it to reflect the time in another time zone (our users can define their time zone on their own and do not have to use SC regional settings).

For example I know that in Beijing there is UTC + 8hrs, so I need to x=8 and I need to add this amount to UTC time string 2018-10-15T10:00:00Z getting date time object 2018/10/15 18:00

But when I use this conversion action it already modifies the hours according to time zone in SC regional settings so 2018-10-15T10:00:00Z becomes 2018/10/15 12:00 and adding 8 hrs to this becomes 2018/10/15 20:00 and not 2018/10/15 18:00

When I use this ISO time string directly in Calculate date action as a Date input parameter but this also modifies the datetime object before actually adding some hours to it so it again becomes 2018/10/15 20:00 and not 2018/10/15 18:00.

Is there any way to create dt object which would be produced from ISO date time string and by adding an hours to it without the original value being effected by SC regional settings time zone?

EDIT: so changing SC time zone to UTC does not help either, the conversion of the string still comes out as 2018/10/15 12:00

Thanx a lot for any help here.

Jan Marek

0 Kudos
Reply
emha
Nintex Newbie

Re: convert string date to date

Jump to solution

Hm, why would you want to calculate timezone shift on your own?

2018-10-15T10:00:00Z (ie. UTC+0) is just the same time as 2018-10-15T18:00:00+08:00

you may check with whatever online converter

sharepoint reflects client's  timezone, so if you store datetime 2018-10-15T10:00:00Z in UTC+0 timezone, it correctly shows it as 2018-10-15T18:00:00 in UTC+8 timezone

Reply
marekan
Nintex Newbie

Re: convert string date to date

Jump to solution

I am sorry to be replying this late.

I have solved it in the meantime but if you are interested then here is the story..

The story is that we have thousands of site collections in our farm and users all over the world. One functionality we provide on those site collections is the possibility of creating a meeting minutes to the word file out of Meetings list on those SCs

Meetings list has a few secondary lists connected to it, such as Agenda, Tasks etc.

To provide this meeting minutes creation functionality we decided to do one central workflow residing on the system site collection (so we would not have to maintain thousands of workflows on each individual SC).

When user clicks the button in the Meetings list item form, the form starts the workflow on the system site collection passing needed parameters to this workflow (such as URL from it was triggered, IDs of the lists in needs to query, some items IDs etc. - not really important what the parameters are) and the workflow takes care of creating the meeting minutes on the site from which it was triggered.

Workflow runs under a service account which is SC admin on all SCs in our farm. This is needed because the user triggering the workflow may not have access to all needed resources for meeting minutes creation.

Workflow uses Query list (with "on alternate site" option) actions to get needed data before it puts them into the word template. All is going fine when the user is in CET time zone. But when the user is out of this time zone (China, Brazil, US etc.) then the Query list action is not pulling the correct date times values. For instance, item is created by CET user and has meeting start date on 29.11.2018 16:00, which when opened by Chinese user should render  29.11.2018 23:00 and it does in the item form but when this user creates the meeting minutes the meeting start time comes out as 29.11.2018 11:00.

On each site collection there is time zone set to UTC+1 in regional settings and the service account uses this settings.

I tried to use GetListItems method of lists.asmx web service for items dt fields instead of Query list action with queryOptions datesInUTC=false but this did not help, the time still was not correct. Then i tried to calculate the time difference directly in the Meetings list item form and send the result to the WF as a parameter and adding/substracting this value out of items dt fields (this time with queryOptions datesInUTC=true in GetListItems method) but this resulted in the problem described in my original question.

In the end I solved it by doing the GetListItems method of lists.asmx web service for items dt fields with queryOptions datesInUTC=false directly in the Meetings list item form and sending the result to the WF as a parameter and using the values directly in the meeting minutes file without doing any modifications on it in the WF.

So, this is the long, surely boring story..and I am sure this could have been done a lot easier but I am doing the best I can

Reply