How do I get items with a filter on dates?

Answered

Comments

12 comments

  • Andreas Haugstrup Pedersen

    You can see all the options for filters at https://developers.podio.com/doc/filters -- the date options are at the bottom and the special cases such as created on date are at the top.

    Some examples with the PHP client and created_on:

    // Absolute date

    $collection = PodioItem::filter($app_id, array('filters' => array('created_on' => array('from' => '2011-01-01', 'to' => '2011-02-01'))));

    // Relative date. Everything created in the past week

    $collection = PodioItem::filter($app_id, array('filters' => array('created_on' => array('from' => '-1w', 'to' => '+0dr')))); 

    1
    Comment actions Permalink
  • Louise Mattsson

    Thank you!

    0
    Comment actions Permalink
  • Victoria Aparicio

    Hello, how can I get the current week using this array('from' => '-1w', 'to' => '+0dr')? please. thanks

    0
    Comment actions Permalink
  • Andreas Garnæs

    Victoria, could you please elaborate on what you're trying to achieve?

    0
    Comment actions Permalink
  • Victoria Aparicio

    Hello Andreas, I want to get a report, so I want to get items that where created in the current week.

    0
    Comment actions Permalink
  • Victoria Aparicio

    I'm trying to do this

    $leads = PodioItem::filter(12963593, array(
    'filters' => array(
    $app_reference_field_id => array($filter_target_item_id),
    $date_lead_created => array(
    'from' => '-1w', 'to' => '+0dr' // but this option got the items that where created in the last week until today, I don't want it
    )
    ),
    ));

    0
    Comment actions Permalink
  • Andreas Garnæs

    Victoria, please try this:

    "from" => "-1dr", "to" => "-1dr"
    
    0
    Comment actions Permalink
  • Victoria Aparicio

    that condition doesn't get the date "06/10/2015", I wan to get the item of the current week

    0
    Comment actions Permalink
  • Andreas Garnæs

    Ah, sorry I got that wrong. Please try this instead:

    "from" => "+0wr", "to" => "+0wr"
    
    0
    Comment actions Permalink
  • Victoria Aparicio

    Thanks Andreas, It works!!!

    0
    Comment actions Permalink
  • Victoria Aparicio

    Hello, I have an issue, I want to get all the tasks using this filter
    $val=PodioTask::get_all(array(

    'due_date' => array(
    'from' => date('Y-d-m') , 'to' => date('Y-d-m')
    ),
    'completed' => 'false',
    'responsible' => 2565874 ,
    'space' => 3806872,
    'grouping' => 'due_date',
    'offset' => 0,
    'limit' => 100
    ));

    I got this error
    "The values are not in the right format"

    0
    Comment actions Permalink
  • Andreas Garnæs

    Victoria, please ensure that the dates are in the format YYYY-MM-DD.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk