Filtering submit_time

October 18th, 2014

As of version 2.2, filtering can be done relative to the current time. This is in response to people wanting to get “all submission in the last week” for example.

Do this using “submit_time” in the filter. The submit_time is a Unix time stamp of when a submission was received. You can use a raw timestamp like:

[cfdb-table form="Contact form" filter="submit_time>1318262984"]

But these timestamp values are hard for a human to compute and understand. Now you can use:

[cfdb-table form="Contact form" filter="submit_time>October 10, 2011"]

Or you can use a time relative to today.
Examples:

[cfdb-table form="Contact form" filter="submit_time>last week"]
[cfdb-table form="Contact form" filter="submit_time>last Friday"]
[cfdb-table form="Contact form" filter="submit_time>-1 week 2 days 4 hours 2 seconds"]

These kinds of English descriptions of time are parsed based on the PHP strtotime function.

To search between dates, use && (see more on filter)

[cfdb-table form="Contact form" filter="submit_time>2013-03-15&&submit_time<2013-03-25"]

Don’t Make Easy Mistakes

Do you know what is wrong with this? You think it is going to get values from the last week but it does not.

[cfdb-table form="form1" filter="submit_time>1 week"] WRONG!
“1 week” is interpreted as one week from today. “submit_time>1 week” means submissions received one week in the future.  So of course it shows nothing!
[cfdb-table form="form1" filter="submit_time>-1 week"] RIGHT!

Use “-” to indicate “now – 1 week in the past”.

Don’t get Confused About Greater-than and Less-than

  • Greater-than mean “more recent than”
  • Less-than mean “before”

If you have something like “submit_time>4 weeks ago” that does NOT mean older than 4 weeks ago, it means you are looking for submissions with submit_time greater than (more recent than) 4 weeks ago.

 Check it

To check if your English time description works, go to the Shortcode builder page, in the filter section select “submit_time”, enter a value and click “Validate submit_time”. It will tell you exactly what day and time your value resolves to.

  1. Naama
    January 8th, 2013 at 03:33 | #1

    Great! just what i was looking for 🙂

  2. Dickson
    June 12th, 2014 at 02:09 | #2

    Hello Michael,

    Is there anyway I can use user’s input instead of a hardcoded date in the filter query?
    Thanks 🙂

    Dickson

  3. Michael Simpson
    June 12th, 2014 at 06:53 | #3
  4. Dickson
    June 13th, 2014 at 03:43 | #4

    Thanks alot Michael! I got it!
    Dickson

Comments are closed.  Go To Support Forum