mel47 Posted April 4, 2018 Share Posted April 4, 2018 Hi, I need to find unique date. With help here, I'm able to filter to unique results. However, I'm not sure if I stored the date as datefield, so I can manipulate it after. $uniques = array(); foreach ($page->date_rp as $date) { foreach ($date->date_gp as $d) { $uniques[$d->id] = $d->date; } foreach ($uniques as $id => $date) { $out .= strftime('%e %h', $date->getUnformatted("date")) ; //Exception: Call to a member function getUnformatted() on string } } date_rp is a repeater. date_gp is a PageArray containing a page with the field date (datetime field) Thanks! Link to comment Share on other sites More sharing options...
Macrura Posted April 4, 2018 Share Posted April 4, 2018 $date->getUnformatted("date") that method is only going o work for a field, like $page->getUnformatted("field")' Link to comment Share on other sites More sharing options...
mel47 Posted April 4, 2018 Author Share Posted April 4, 2018 ah, fell dumb, found it: $uniques = array(); foreach ($page->date_rp as $date) { foreach ($date->date_gp as $d) { $uniques[$d->id] = strftime('%e %h', $d->getUnformatted("date")); } } foreach ($uniques as $id => $date) { $out .= $date; } Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now