mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add timezone conversion unit test
This commit is contained in:
parent
4eb42e0b05
commit
c269ae29e6
1 changed files with 10 additions and 0 deletions
|
@ -1235,4 +1235,14 @@ class CakeTimeTest extends CakeTestCase {
|
||||||
$this->assertEquals('2019-01-31 03:00:00', $actual);
|
$this->assertEquals('2019-01-31 03:00:00', $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testTimezoneConversionToUTCPlainPHP() {
|
||||||
|
date_default_timezone_set('Europe/Copenhagen'); // server timezone
|
||||||
|
$clientTimeZone = new DateTimeZone('Asia/Bangkok');
|
||||||
|
$clientDateTime = new DateTime('2019-01-31 10:00:00', $clientTimeZone);
|
||||||
|
// Convert to UTC.
|
||||||
|
$clientDateTime->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
$actual = $clientDateTime->format('Y-m-d H:i:s');
|
||||||
|
$this->assertEquals('2019-01-31 03:00:00', $actual);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue