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