$currentDate = date('Y-m-d'); $formattedDate = CRM_Utils_Date::customFormat($currentDate, 'M d, Y'); echo $formattedDate;
$contactId = 123; $contactDate = civicrm_api3('Contact', 'getvalue', [ 'id' => $contactId, 'return' => 'birth_date', ]); $formattedDate = CRM_Utils_Date::customFormat($contactDate, 'd/m/Y'); echo $formattedDate;The output for this code will be something like "15/02/2022". In conclusion, the CRM_Utils_Date customFormat function is part of the CiviCRM package/library and allows developers to format dates in a custom manner that suits their needs.