public function testGetTimeZone() { $date = new Date(new Year(2013), Month::DECEMBER(), new MonthDay(3)); $time = new Time(new Hour(20), new Minute(50), new Second(10)); $dateTime = new DateTime($date, $time); $timeZone = new TimeZone(new StringLiteral('Europe/Madrid')); $dateTimeWithTz = new DateTimeWithTimeZone($dateTime, $timeZone); $this->assertTrue($timeZone->sameValueAs($dateTimeWithTz->getTimeZone())); }
public function testToString() { $timeZone = new TimeZone(new StringLiteral('Europe/Madrid')); $this->assertEquals('Europe/Madrid', $timeZone->__toString()); }
/** * Returns a DateTimeWithTimeZone object using current DateTime and default TimeZone. * * @return DateTimeWithTimeZone */ public static function now() { return new static(DateTime::now(), TimeZone::fromDefault()); }