Datetime segmentation operators

A number of segmentation rules in Leanplum work with Dates - both to filter a date interval or to compare a date against a point in time.

This article provides a reference for working with dates in segmentation.

Segmentations which work with dates:

  • First occurrence
  • Last occurrence
  • Last session start
  • Last session start time
  • First run
  • Last active

The following operators are available when working with Dates and Times in segmentation:

OperatorDescription
Is afterHappened after a particular time.

Example: "Last occurrence of Purchase is after 05/26/2020 12:00 AM PST" will include all users whose last purchase happened between May 26 2020 and now.

Another way to represent this would be "Last occurrence of Purchase > 05/26/2020 12:00 AM PST".
Is not afterHappened at or before a particular time.

Example: "Last occurrence of Purchase is not after 05/26/2020 12:00 AM PST" will include all users whose last purchase happened at 12:00 AM PST on 05/26/2020 or before that.

Another way to represent this would be "Last occurrence of Purchase <= 05/26/2020 12:00 AM PST".
Is beforeHappened before a particular time.

Example: "Last occurrence of Purchase is before 05/26/2020 12:00 AM PST" will include all users whose last purchase happened before May 26 2020.

Another way to represent this would be "Last occurrence of Purchase < 05/26/2020 12:00 AM PST".
Is not beforeHappened at or after a particular time.

Example: "Last occurrence of Purchase is not before 05/26/2020 12:00 AM PST" will include all users whose last purchase happened at 12:00 AM PST on 05/26/2020 or after that.

Another way to represent this would be "Last occurrence of Purchase >= 05/26/2020 12:00 AM PST".
Is betweenHappened between two particular times on the calendar.

Example: "Last occurrence of Purchase is between 05/20/2020 12:00 AM PST AND 05/26/2020 12:00 AM PST".

Another way to represent this would be "05/20/2020 12:00 AM PST < Last occurrence of Purchase < 05/26/2020 12:00 AM PST".

Tip: When using "in between", always put the earlier date first. For relative dates that would be "between 10 days ago and 3 days ago".

Using Exact vs Relative dates

Leanplum lets you chose between using Exact and Relative dates when segmenting based on Datetime properties.

Exact dates work better when building audiences for calendar-driven engagement, such as users who have last logged in before 01/01/2020.

Relative dates are to be preferred when building audiences for automated or triggered campaigns, such as users who purchased last month, but not this month.

Accepted date formats

👍

ISO-8601 supported

Leanplum supports ISO-8601 date formats.

You can track custom dates in Leanplum for user attributes or event parameters.