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