Example #1
0
 /**
  * Enter description here...
  *
  * @param BaseObject $obj - the object to be invoked with method $date_method_str
  * @param unknown_type $format
  * @return formated date according to kaltura's string rules
  */
 public static function formatKalturaDate(BaseObject $obj, $date_method_str, $format = self::KALTURA_FORMAT)
 {
     // prepare an array with the object to invoke & the date_method
     $f = array($obj, $date_method_str);
     if ($format == self::KALTURA_FORMAT) {
         // call parent with NULL so there will be no formating of the original date
         $params = array(NULL);
         $date = call_user_func_array($f, $params);
         // now - we'll format it our way
         return kString::formatDate($date);
     } else {
         if ($format == self::MODEL_DEFAULT_FORMAT) {
             // get default value from obj and pass no values
             return call_user_func($f);
         } else {
             // get the value from obj and use the given format
             return call_user_func($f, $format);
         }
     }
 }
Example #2
0
function age($partner)
{
    $created_at = $partner->getCreatedAt(null);
    $str = kString::formatDate($created_at);
    return $str;
}