You are here

public static function jDateTime::strftime in Persian Date for Drupal 8 8.4

Parameters

$format:

bool $stamp:

null $timezone:

Return value

mixed

1 call to jDateTime::strftime()
jDate::format in src/Library/Jalali/jDate.php

File

src/Library/Jalali/jDateTime.php, line 488

Class

jDateTime
Class jDateTime @package Morilog\Jalali

Namespace

Drupal\persian_date\Library\Jalali

Code

public static function strftime($format, $stamp = false, $timezone = null) {
  $str_format_code = array(
    "%a",
    "%A",
    "%d",
    "%e",
    "%j",
    "%u",
    "%w",
    "%U",
    "%V",
    "%W",
    "%b",
    "%B",
    "%h",
    "%m",
    "%C",
    "%g",
    "%G",
    "%y",
    "%Y",
    "%H",
    "%I",
    "%l",
    "%M",
    "%p",
    "%P",
    "%r",
    "%R",
    "%S",
    "%T",
    "%X",
    "%z",
    "%Z",
    "%c",
    "%D",
    "%F",
    "%s",
    "%x",
    "%n",
    "%t",
    "%%",
  );
  $date_format_code = array(
    "D",
    "l",
    "d",
    "j",
    "z",
    "N",
    "w",
    "W",
    "W",
    "W",
    "M",
    "F",
    "M",
    "m",
    "y",
    "y",
    "y",
    "y",
    "Y",
    "H",
    "h",
    "g",
    "i",
    "A",
    "a",
    "h:i:s A",
    "H:i",
    "s",
    "H:i:s",
    "h:i:s",
    "H",
    "H",
    "D j M H:i:s",
    "d/m/y",
    "Y-m-d",
    "U",
    "d/m/y",
    "\n",
    "\t",
    "%",
  );

  //Change Strftime format to Date format
  $format = str_replace($str_format_code, $date_format_code, $format);

  //Convert to date
  return self::date($format, $stamp, $timezone);
}