Code Samples: Return a Calculated Value in a Pods Template - Pods Docs

PHOTO EMBED

Mon Nov 27 2023 19:35:39 GMT+0000 (Coordinated Universal Time)

Saved by @dmsearnbit

function return_current_age( $id ) {
  $pods = pods('case',$id);
  $age = intval($pods->field('age_d'));
  $date_missing = $pods->field('c_date');
  $date = date("Y-m-d");
  $date_diff = intval($date - $date_missing);
  $age_now = intval($age + $date_diff);
  return $age_now;
}
content_copyCOPY

https://docs.pods.io/code-snippets/return-calculated-value-pods-template/