xref: /PHP-7.1/ext/date/tests/date_modify-1.phpt (revision cf60f26d)
1--TEST--
2date_modify() function [1]
3--SKIPIF--
4<?php if (!function_exists('date_create')) echo "SKIP"; ?>
5--FILE--
6<?php
7date_default_timezone_set("Pacific/Kwajalein");
8$ts = date_create("Thu Aug 19 1993 23:59:59");
9echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
10$ts->modify("+1 second");
11echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
12
13date_default_timezone_set("Europe/Amsterdam");
14$ts = date_create("Sun Mar 27 01:59:59 2005");
15echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
16$ts->modify("+1 second");
17echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
18
19$ts = date_create("Sun Oct 30 01:59:59 2005");
20echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
21$ts->modify("+ 1 hour 1 second");
22echo date_format($ts, 'D, d M Y H:i:s T'), "\n";
23?>
24--EXPECT--
25Thu, 19 Aug 1993 23:59:59 -12
26Sat, 21 Aug 1993 00:00:00 +12
27Sun, 27 Mar 2005 01:59:59 CET
28Sun, 27 Mar 2005 03:00:00 CEST
29Sun, 30 Oct 2005 01:59:59 CEST
30Sun, 30 Oct 2005 03:00:00 CET
31