niceDate() public static method

Options: - timezone: User's timezone - default: Default string (defaults to "-----") - oclock: Set to true to append oclock string
public static niceDate ( string | null $dateString = null, string | null $format = null, array $options = [] ) : string
$dateString string | null
$format string | null Format (YYYY-MM-DD, DD.MM.YYYY)
$options array Options
return string
Exemplo n.º 1
0
 /**
  * Test that input as date only (YYYY-MM-DD) does not suddendly return a
  * different date on output due to timezone differences.
  * Here the timezone should not apply since we only input date and only output
  * date (time itself is irrelevant).
  *
  * @return void
  */
 public function testDateWithTimezone()
 {
     $res = setlocale(LC_TIME, 'de_DE.UTF-8', 'deu_deu');
     //$this->assertTrue(!empty($res));
     Configure::write('Config.timezone', 'America/Anchorage');
     $ret = $this->Time->niceDate('2009-12-01');
     //debug($ret);
     $this->assertEquals('01.12.2009', $ret);
     $ret = $this->Time->localDate('2009-12-01');
     //debug($ret);
     $this->assertEquals('01.12.2009', $ret);
 }