Subtract 1 day from timestamp variable

I am trying to use the api call to return the recently updated contact records from our CRM system. The last modified date/time in the CRM is in the timestamp (linux) format. I can subtract 1 day from the “now” variable, but it isn’t in the correct format to filter on the lastmodified date field. I have tried “adddays” function to the timestamp variable, but it isn’t working as expected.

Option 1 - Has anyone been able to add or subtract days to the timestamp variable?
Option 2 - Is there a way to format the “now” variable into the timestamp format?

Failed using “now” variable

Failed trying to subtract 1 day from “timestamp” variable.

Works using “timestamp” variable with out trying subtract days
image

I need to try to get a timestamp value that I can use to return any records that were updated in the last 1day/24hrs.

Any thoughts?

I suspect you need to use dateformat to format the timestamp. You can then use adddays to make the necessary calculation.

1 Like

I think you’re right. The issue is probably with the fact your timestamp is a numeric value and you need to convert it first to a proper date datatype. I think you can do that with the parseDate() function. Once you get the number into a date data type you can use addDays() on the resulting value

addDays(parsedate(<your timestamp>),-1) should return a proper date data type.

Now the Hubspot filtering expectation is a whole nother matter. I think the GTE operator may expect a simple date without the time component like

2010-01-01

You should experiment to see without any variables what sort of format actually does work by hard coding the value part of the filter for the Hubspot Search module. See what format works and see if you can get your data into this format.

1 Like