Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | * $Id$ |
17 | * | |
18 | */ | |
19 | ||
20 | /** | |
21 | * Convert the date string "YYYY-MM-DD" to "MM<long> DD, YYYY". | |
22 | * | |
6a0b768e TO |
23 | * @param string $dateString |
24 | * Date which needs to converted to human readable format. | |
6a488035 | 25 | * |
77b97be7 EM |
26 | * @param null $dateFormat |
27 | * @param bool $onlyTime | |
28 | * | |
a6c01b45 | 29 | * @return string |
353ffa53 | 30 | * human readable date format | invalid date message |
6a488035 TO |
31 | */ |
32 | function smarty_modifier_crmDate($dateString, $dateFormat = NULL, $onlyTime = FALSE) { | |
33 | if ($dateString) { | |
34 | // this check needs to be type sensitive | |
35 | // CRM-3689, CRM-2441 | |
36 | if ($dateFormat === 0) { | |
37 | $dateFormat = NULL; | |
38 | } | |
39 | if ($onlyTime) { | |
40 | $config = CRM_Core_Config::singleton(); | |
41 | $dateFormat = $config->dateformatTime; | |
42 | } | |
43 | ||
44 | return CRM_Utils_Date::customFormat($dateString, $dateFormat); | |
45 | } | |
46 | return ''; | |
47 | } |