summaryrefslogtreecommitdiff
path: root/ext/date/tests/date_create-1.phpt
blob: 365d54dc9469e68d48ea03b8a8ce355962e4cf88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--TEST--
date_create() function [1]
--SKIPIF--
<?php if (!function_exists('date_create')) echo "SKIP"; ?>
--FILE--
<?php
date_default_timezone_set('Europe/Oslo');
$tz1 = timezone_open("GMT");
$tz2 = timezone_open("Europe/London");
$tz3 = timezone_open("America/Los_Angeles");
$d = array();
$d[] = date_create("2005-07-14 22:30:41");
$d[] = date_create("2005-07-14 22:30:41 GMT");
$d[] = date_create("2005-07-14 22:30:41 CET");
$d[] = date_create("2005-07-14 22:30:41 CEST");
$d[] = date_create("2005-07-14 22:30:41 Europe/Oslo");
$d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles");

$d[] = date_create("2005-07-14 22:30:41", $tz1);
$d[] = date_create("2005-07-14 22:30:41", $tz2);
$d[] = date_create("2005-07-14 22:30:41", $tz3);

$d[] = date_create("2005-07-14 22:30:41 GMT", $tz1);
$d[] = date_create("2005-07-14 22:30:41 GMT", $tz2);
$d[] = date_create("2005-07-14 22:30:41 GMT", $tz3);

$d[] = date_create("2005-07-14 22:30:41 Europe/Oslo", $tz1);
$d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles", $tz2);

foreach($d as $date) {
	echo $date->format(DateTime::ISO8601), "\n";
}
?>
--EXPECT--
2005-07-14T22:30:41+0200
2005-07-14T22:30:41+0000
2005-07-14T22:30:41+0100
2005-07-14T22:30:41+0200
2005-07-14T22:30:41+0200
2005-07-14T22:30:41-0700
2005-07-14T22:30:41+0000
2005-07-14T22:30:41+0100
2005-07-14T22:30:41-0700
2005-07-14T22:30:41+0000
2005-07-14T22:30:41+0000
2005-07-14T22:30:41+0000
2005-07-14T22:30:41+0200
2005-07-14T22:30:41-0700