public function browse() {
$dateFields = NULL;
$cgcount = 0;
+ $attributes = array();
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL,
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
+ $actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
+ $dateFormat = (array) CRM_Utils_Array::value($returnValues['date_format'], $actualPHPFormats);
+ $timeFormat = CRM_Utils_Array::value('time_format', $returnValues);
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (is_numeric($fieldId)) {
$customValue = &$val;
if (!empty($dateFields) && array_key_exists($fieldId, $dateFields)) {
- // formated date capture value capture
+ // formatted date capture value capture
$dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
+
+ //set date and time format
+ switch ($timeFormat) {
+ case 1:
+ $dateFormat[1] = 'g:iA';
+ break;
+
+ case 2:
+ $dateFormat[1] = 'G:i';
+ break;
+
+ default:
+ // if time is not selected remove time from value
+ $result[$recId][$fieldId] = substr($result[$recId][$fieldId], 0, 10);
+ }
+ $result[$recId][$fieldId] = CRM_Utils_Date::processDate($result[$recId][$fieldId], NULL, FALSE, implode(" ", $dateFormat));
}
else {
// assign to $result