How-to: Use Attribute Updates to Reformat Timestamps

In, 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.

Step 1: Create a Segment that Captures the The Attribute You Want to Reformat

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.

Screen Shot 2020-07-29 at 2.28.08 PM
Screen Shot 2020-07-29 at 2.28.08 PM

Step 2: Create a Campaign Triggered by that Segment

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.

Step 3: Add an Attribute Update to Fix the Typo

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.

Screen Shot 2020-07-29 at 2.44.56 PM
Screen Shot 2020-07-29 at 2.44.56 PM

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 expects use the filter | date: "%s".

Step 4: Start Your Campaign

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.

image {height="" width=""}

Copied to clipboard!