xref: /PHP-7.0/ext/date/tests/bug33532.phpt (revision 39dd7153)
1--TEST--
2Bug #33532 (Different output for strftime() and date())
3--INI--
4error_reporting=2047
5date.timezone=UTC
6--SKIPIF--
7<?php
8if(PHP_OS == 'Darwin' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin and Windows");
9?>
10--FILE--
11<?php
12
13setlocale(LC_ALL, 'C');
14
15print "TZ has NOT been set\n";
16print "Should strftime==datestr? Strftime seems to assume GMT tStamp.\n";
17$input = "10:00:00 AM July 1 2005";
18print "input    " . $input . "\n";
19$tStamp = strtotime($input);
20print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n";
21print "datestr  " . date ("H:i:s A F j Y T", $tStamp) . "\n";
22
23print "\nSetting TZ\n";
24date_default_timezone_set('Australia/Sydney');
25putenv("TZ=Australia/Sydney");
26$input = "10:00:00 AM July 1 2005";
27print "input    " . $input . "\n";
28$tStamp = strtotime($input);
29print "strftime " . strftime("%r %B%e %Y %Z %z", $tStamp) . "\n";
30print "datestr  " . date ("H:i:s A F j Y T", $tStamp) . "\n";
31
32?>
33--EXPECT--
34TZ has NOT been set
35Should strftime==datestr? Strftime seems to assume GMT tStamp.
36input    10:00:00 AM July 1 2005
37strftime 10:00:00 AM July 1 2005 UTC +0000
38datestr  10:00:00 AM July 1 2005 UTC
39
40Setting TZ
41input    10:00:00 AM July 1 2005
42strftime 10:00:00 AM July 1 2005 AEST +1000
43datestr  10:00:00 AM July 1 2005 AEST
44