Jump to content

Unique array - solved


mel47
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...