Esempio n. 1
0
 /**
  * @covers Fuel\Common\Date::format
  * @group Common
  */
 public function testFormat()
 {
     $expected = '2013-12-22 23:23:38';
     $result = $this->instance->format('mysql');
     $this->assertEquals($result, $expected);
     $expected = '2013-12-22';
     $result = $this->instance->format('mysql_date');
     $this->assertEquals($result, $expected);
     $expected = '2013-12-22 23:23:38';
     $result = $this->instance->format('mysql', true);
     $this->assertEquals($result, $expected);
     // New York is UTC-5, a delta of -6
     $expected = '2013-12-22 17:23:38';
     $result = $this->instance->format('mysql', 'America/New_York');
     $this->assertEquals($result, $expected);
     // Moscow is UTC+4, a delta of +3
     $expected = '2013-12-23 02:23:38';
     $result = $this->instance->format('mysql', 'Europe/Moscow');
     $this->assertEquals($result, $expected);
     // use a date() type format string
     $expected = '2013-12-22 23:23:38';
     $result = $this->instance->format('Y-m-d H:i:s');
     $this->assertEquals($result, $expected);
     $expected = 'Sun Dec 22 23:23:38 2013';
     $result = $this->instance->format('D M d H:i:s Y');
     $this->assertEquals($result, $expected);
 }
Esempio n. 2
0
 /**
  * Sets the default timezone, the current display timezone of the application
  *
  * @return  DateTimeZone
  */
 public static function defaultTimezone($timezone = null)
 {
     return CommonDate::defaultTimezone($timezone);
 }