strftime() public static method

public static strftime ( $format, boolean $stamp = false, null $timezone = null ) : mixed
$format
$stamp boolean
$timezone null
return mixed
Esempio n. 1
0
 /**
  * @param $format
  * @return bool|string
  */
 public function format($format)
 {
     // convert alias string
     if (in_array($format, array_keys($this->formats))) {
         $format = $this->formats[$format];
     }
     // if valid unix timestamp...
     if ($this->dateTime !== false) {
         return jDateTime::strftime($format, $this->dateTime->getTimestamp(), $this->dateTime->getTimezone());
     } else {
         return false;
     }
 }
Esempio n. 2
0
 public function testStrftime()
 {
     $this->assertTrue(jDateTime::strftime('Y-m-d', strtotime('2016-05-8')) === '1395-02-19');
     $this->assertTrue(jDateTime::convertNumbers(jDateTime::strftime('Y-m-d', strtotime('2016-05-8'))) === '۱۳۹۵-۰۲-۱۹');
     $this->assertFalse(jDateTime::strftime('Y-m-d', strtotime('2016-05-8')) === '۱۳۹۵-۰۲-۱۹');
 }