Calculate Difference between Timestamps


#1

Hello,

I’m trying to calculate the difference between two timestamps using the SQL Formula Node and the dateMinus function.

I’m assuming the dateMinus function takes in 2 parameters (both of which would be timestamps or dates).

I want to calculate the difference between end and start (column names that contain the timestamps of interest).

When I run the node, I get an issue where the SQL formula node errors out because the timestamp isn’t in the correct format.

For example, the timestamp from the fetch node is 2016-11-29 00:00:00.0 whereas the dateMinus function is probably expecting a timestamp in the form of YYYY-MM-DDTHH:MM:SS.

I can see the YYYY-MM-DDTHH:MM:SS format in Data Explorer, so it appears that Ex Machina is formatting the timestamp differently when going through the fetch node.

Attached is a screenshot of the error message from the SQL formula node.

Any ideas on how to accomplish this date difference calculation?

Thanks.


#2

Solved the issue by leveraging a different SQL formula:

datediff(end, start)

Thanks.