You are here

public function Carbon::formatLocalized in Persian Date for Drupal 8 8.4

Format the instance with the current locale. You can set the current locale using setlocale() http://php.net/setlocale.

Parameters

string $format:

Return value

string

File

src/Library/Carbon/Carbon.php, line 1194

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function formatLocalized($format) {

  // Check for Windows to find and replace the %e
  // modifier correctly
  if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\\1%#d', $format);
  }
  $formatted = strftime($format, strtotime($this));
  return static::$utf8 ? utf8_encode($formatted) : $formatted;
}