cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

DateTime Parameter can't save to datetime field

RoyB
New Contributor III

Iโ€™m calling a child pipeline to do an insert
Iโ€™m passing a datetime field, but in the child parameter it is now a string
How do I convert it back to datetime?

In the parent before I execute the child the value is:
1996-08-26T00:00:00.000

In the child, the value is: (Iโ€™ve saved to a string field to test)
{โ€œ_snaptype_localdatetimeโ€:โ€œ1996-08-26T00:00:00.000โ€}

How do I convert this back to a date?

Iโ€™ve tried Date.parse(_StartDate) and it doesnโ€™t recognise the parameter value as something that can be converted to a date

3 REPLIES 3

bojanvelevski
Valued Contributor

Hello @RoyB,

Try this => Date.parse(_StartDate.toString())

Regards,

Bojan

SpiroTaleski
Valued Contributor

@RoyB

You can try with the following expression in the child pipe:

Date.parse(JSON.parse(_StartDate))

Or to avoid sending the string {โ€œ_snaptype_localdatetimeโ€:โ€œ1996-08-26T00:00:00.000โ€} to the child pipeline, from the parent pipeline try to send the date field(StartDate) as a string(not as a datetime), and then try to convert to date with Date.parse(_StartDate).

Regards,
Spiro Taleski

RoyB
New Contributor III

Iโ€™ve tried both of those, and each time it errors as not a number error

We managed to build a work around though, buy setting up some snaps to except the values as part of the incoming document rather than passing a parameter

Thanks for the help