Time-related targeting operators
In-depth examples on Targets with "is past", "is since", and other time-related operators
Many segments require choosing an operator (is greater than, is between, is set, contains, etc.) to tell Leanplum how to compare the specified value against the given segment. Below are all of the available operators for time-based parameters and what each of them mean.
- is past – happened after the given time (session is after 1/2/15)
- is prior to – happened before the given time (session is before 1/2/15)
- is since – happened at or after the given time (session is after 1/2/15)
- is until – happened at or before this point (sessions logged before 1/2/15)
To better understand time-related operators, let's look at some examples. For the following examples, we'll assume that today is June 23rd, 2016.
is Since
Last active "is since" 1 week ago. Ran on June 23rd 2016
- Today is June 23rd, if we want time of last active is since 1 week ago. Leanplum will filter all users who were last active at or after 1 week ago, which is Thursday, 16 Jun 2016 00:00:00 PST.
- Exact filter: "Time of Last Active" >= Thursday, 16 Jun 2016 00:00:00 PST
Time of first run "is since" 4 days ago. Ran on June 23rd 2016
- Today is June 23rd, if we want time of first run "is since" 4 days ago, Leanplum will filter all users whose time of first run is at or after 4 days ago, which is Sunday, 19 Jun 2016 00:00:00 PST
- Exact filter: "Time of first run" >= Sunday, 19 Jun 2016 00:00:00 PST
Time of first occurrence of register "is since" 1 day ago. Ran on June 23rd 2016
- If today is June 23rd and we want Time of first occurrence of the "register" event "is since" 1 day ago, the filter would be "Time of first occurrence" >= 1466578800
- Where 1 day ago is Wednesday, 22 Jun 2016 07:00:00 GMT = June 22 00:00:00 PST = 1466578800
is Prior
Time of first run "is prior" to 2 days ago. Ran on June 23rd 2016
- Today is June 23rd, if we want time of first run "is prior" to 2 days ago, Leanplum will filter all users whose time of first run is before 2 days ago, which is Tuesday, 21 Jun 2016 00:00:00 PST.
- Exact filter: "Time of first run" < Tuesday, 21 Jun 2016 00:00:00 PST
Time of first run "is prior" to 24 hours ago. Ran on June 23rd 2016, 7:10pm PST
- Today is June 23rd, 7:10pm PST, if we want time of first run "is prior" to 24 hours ago, Leanplum will filter all users whose time of first run is before 24 hours ago, which is Wednesday, 22 Jun 2016 19:05:11 PST
- Exact filter: "Time of first run" < Wednesday, 22 Jun 2016 19:05:11 PST
is Between
Time of first run "is between" 7 days ago and 4 days ago. Ran on June 23rd 2016
- Today is June 23rd, if we want time of first run "is between" 7 days ago and 4 days ago, Leanplum will filter all users whose time of first run is between the 16th (7 days ago) and the 19th (4 days ago).
- Exact filter: "Time of first run" >= 1466060400 and "Time of first run" <= 1466319600
Another way to represent this filter would be "Time of first run" >= Thursday, 16 Jun 2016 07:00:00 GMT and "Time of first run" <= Sunday, 19 Jun 2016 07:00:00 GMT
- Where 4 days ago is Sunday, 19 Jun 2016 07:00:00 GMT = Sunday, 19 Jun 2016 00:00:00 PST = 1466319600
- Where 7 days ago is Thursday, 16 Jun 2016 07:00:00 GMT = Thursday, 16 Jun 2016 00:00:00 PST = 1466060400
Keep in mind that when using the 'is between' operator, you would have to input the older date/time first and then the more recent one.
Refer to the example above: Time of first run "is between" 7 days ago and 4 days ago
Session start in Pacific time "is between" 6/20/2016 8:00am and 6/21/2016 11:59pm
- If we want Session start in Pacific time "is between" 6/20/2016 8:00am and 6/21/2016 11:59pm, the filter would be "Time of last session start" >= 1466434800 and "Time of last session start" <= 1466578740
Another way to represent this filter would be "Time of last session start" >= Monday, 20 Jun 2016 08:00:00 PST and "Time of last session start" <= Tuesday, 21 Jun 2016 23:59:00 PST
- Where Monday, 20 Jun 2016 08:00:00 PST = Monday, 20 Jun 2016 15:00:00 GMT = 1466434800
- Where Tuesday, 21 Jun 2016 23:59:00 PST = Wednesday 22 June 2016 06:59:00 GMT = 1466578740
is Until
Last Active "is until" 360 minutes ago. Ran on June 23rd 2:26pm PST
- If today is June 23rd 2:26pm PST and we want Last Active "is until" 360 minutes ago, the filter would be "Time of Last Active" <= 1466695560
- Where 360 minutes ago is Thursday, 23 Jun 2016 15:26:00 GMT = Thursday, 23 Jun 2016 08:26:00 PST = 1466695560
is Past
Last Active "is past" 48 hours ago. Ran on June 23 2016 14:33:00 PST
- If today is June 23rd 14:33:00 PST and we want time of last active "is past" 48 hours ago, the filter would be "Time of Last Active" > 1466544780
- Where 48 hours ago is Tuesday, 21 Jun 2016 21:33:00 GMT = Tuesday, 21 Jun 2016 14:33:00 PST = 1466544780
Accepted formats for time-based segments
Leanplum accepts many different date/time formats for use with our time-specific segment types, such as:
- MM/DD/YYYY ex: 08/05/2015
- MM/DD/YY ex: 08/05/15
- X months/weeks/days/hours/minutes ago ex: 3 days ago ; 2 hours ago.
- MM/DD/YY XX:XX AM/PM ex: 5/13/16 12:01 am
- MM/DD/YY XX:XX ex: 5/13/16 00:00 to 5/13/16 23:59
If you would like to use the date operators to target "in between" time frames, below are examples of how to do this. The example is targeting users who start the app on August 5th.
- Session start in user's timezone is between "08/05/15 12:00AM" and "08/05/15 11:59PM"
OR... - Session start in user's timezone is between "08/04/15" and "08/06/15"
If a date without a time is specified, the time will default to midnight (00:00) that day.
Only use inequality operators with times, such as since, prior to, and between. The operator “is” will not match any users. (An exact time, such as "is 8:00:00 AM" will pass so instantaneously that no users will be targeted).
Updated over 4 years ago