You are here

public static function DatexFormatter::formatINTL in Datex 7

Formats a date according to format given.

This function uses php-intl methods for converting. PECL package php-intl must be enabled.

1 call to DatexFormatter::formatINTL()
DatexFormatter::format in datex_api/datex_api_classes.inc
Similar to php date_format.

File

datex_api/datex_api_classes.inc, line 366
API and helper functions used by other datex modules.

Class

DatexFormatter
Date tools for Jalali Dates.

Code

public static function formatINTL($date, $format, $tz, $formatter_args) {
  $intl_formatter = new IntlDateFormatter("fa_IR@calendar=persian", IntlDateFormatter::FULL, IntlDateFormatter::FULL, self::getTzString($tz), IntlDateFormatter::TRADITIONAL, self::phpToIntl($format));
  $date = $intl_formatter
    ->format(self::getTimestamp($date));

  // By default undecorates decorated date by intl.
  return isset($formatter_args['decor']) ? $date : self::decor($date, FALSE);
}