I'm trying to get all elements whose custom field satisfies a specific value. I've got the ElementCriteriaModel but I'm unsure how to set the field and value I'm looking for, from the documentation

$criteria = craft()->elements->getCriteria(ElementType::Entry);

Any ideas? If I'm not using the correct service, then which is the recommended one?

Thanks in advance


Field in question is a datetime field by the name startTime. I'm searching for all entries whose date-part matches a given date

  • What's the name of the custom field (and what type is it) and what value are you searching for?
    – Brad Bell
    Sep 14 '15 at 22:00
  • Will update with the additional information
    – user4041
    Sep 15 '15 at 12:13
  • Sorry for the late reply, only just had a chance to actually try it. It seems to work, thank you :)
    – user4041
    Sep 29 '15 at 10:47