How-to: Use Attribute Updates to Reformat Timestamps
In Customer.io, in order to use timestamp fields to their fullest, we require they be formatted in Epoch time. If you’ve already uploaded data with timestamps in a different format, you can follow these steps to reformat your timestamps.
To start, create a segment that capture all the people who have an attribute you want to reformat as a timestamp. You can use the ‘is not a timestamp’ condition, as this will make sure you’re only update attributes that aren’t correctly formatted.
Next, use that segment as the trigger in a new campaign. If your data will still be coming in with the differently formatted timestamp, be sure to make the campaign re-enterable in order to reformat the timestamp whenever it appear. Since this campaign won’t send any messages, you’ll want it to “send” to unsubscribed people as well.
The only action in your workflow should be an Attribute Update. In the Attribute update, you’ll want to replace the value in the attribute with the properly formatted timestamp - which is done through liquid filters.
In this example, our timestamp attribute we want to reformat is a date in the format YYYY-MM-DD. In order to turn this into a timestamp, we need to assign it a time of day - which we can do by the filter
| append: "12:00:00". Next, we need to format that into a timestamp with the filer
| date: "%Y-%m-%d %H:%M:%S". If your date is in a different format, consult the Liquid documentation on how to reformat it. Lastly, to turn it into the format Customer.io expects use the filter
| date: "%s".
Once you’ve set up your attribute update, you’re ready to start your campaign. On the review page, be sure to select
Current people and future additions - that will correct the typo on all current profiles, and keep it corrected if ever that typo should come up again.