php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37650 Two Calender Functions not corresponding
Submitted: 2006-05-31 08:23 UTC Modified: 2006-05-31 09:16 UTC
From: martin at whitewallweb dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.0.3 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: martin at whitewallweb dot com
New email:
PHP Version: OS:

 

 [2006-05-31 08:23 UTC] martin at whitewallweb dot com
Description:
------------
PHP mktime generated timestamps in date function do not return same output as mktime input.

Reproduce code:
---------------
echo date('d m Y',mktime(0, 0, 0, 6, 20, 1948)); output: 21 06 1948

echo date('d m Y',mktime(0, 0, 0, 6, 03, 1944)); output: 04 06 1944

echo date('d m Y',mktime(0, 0, 0, 6, 19, 1960)); output: 20 06 1960

echo date('d m Y',mktime(0, 0, 0, 6, 28, 1956)); output: 29 06 1956

echo date('d m Y',mktime(0, 0, 0, 8, 31, 1952)); output: 01 09 1952

echo date('d m Y',mktime(0, 0, 0, 5, 27, 1960)); output: 28 05 1960

echo date('d m Y',mktime(0, 0, 0, 7, 31, 1960)); output: 01 08 1960


Expected result:
----------------
echo date('d m Y',mktime(0, 0, 0, 6, 20, 1948)); output: 20 06 1948

echo date('d m Y',mktime(0, 0, 0, 6, 03, 1944)); output: 03 06 1944

echo date('d m Y',mktime(0, 0, 0, 6, 19, 1960)); output: 19 06 1960

echo date('d m Y',mktime(0, 0, 0, 6, 28, 1956)); output: 28 06 1956

echo date('d m Y',mktime(0, 0, 0, 8, 31, 1952)); output: 31 08 1952

echo date('d m Y',mktime(0, 0, 0, 5, 27, 1960)); output: 27 05 1960

echo date('d m Y',mktime(0, 0, 0, 7, 31, 1960)); output: 31 08 1960


Actual result:
--------------
echo date('d m Y',mktime(0, 0, 0, 6, 20, 1948)); output: 21 06 1948

echo date('d m Y',mktime(0, 0, 0, 6, 03, 1944)); output: 04 06 1944

echo date('d m Y',mktime(0, 0, 0, 6, 19, 1960)); output: 20 06 1960

echo date('d m Y',mktime(0, 0, 0, 6, 28, 1956)); output: 29 06 1956

echo date('d m Y',mktime(0, 0, 0, 8, 31, 1952)); output: 01 09 1952

echo date('d m Y',mktime(0, 0, 0, 5, 27, 1960)); output: 28 05 1960

echo date('d m Y',mktime(0, 0, 0, 7, 31, 1960)); output: 01 08 1960

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-31 08:36 UTC] derick@php.net
Hei,

what does:

echo date_default_timezone_get(), "\n";

show in that same script?
 [2006-05-31 08:51 UTC] martin at whitewallweb dot com
My apologies, Noticed I selected the wrong PHP version,Using 5.0.3. date_default_timezone_get() does not exist. (Local time is +2 GMT(athenes)).Is there an alternative function I should call for this information? 

Has this been sorted out in 5.1.4?
 [2006-05-31 09:10 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2006-05-31 09:13 UTC] derick@php.net
And yes, it is working for me with 5.1.4:

derick@kossu:/tmp$ php bug37650.php
20 06 1948 EET
03 06 1944 EET
19 06 1960 EET
28 06 1956 EET
31 08 1952 EEST
27 05 1960 EET
31 07 1960 EET

 [2006-05-31 09:13 UTC] derick@php.net
Script is:
derick@kossu:/tmp$ cat bug37650.php
<?php
date_default_timezone_set( 'Europe/Athens' );
echo date('d m Y T',mktime(0, 0, 0, 6, 20, 1948)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 6, 03, 1944)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 6, 19, 1960)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 6, 28, 1956)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 8, 31, 1952)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 5, 27, 1960)), "\n";
echo date('d m Y T',mktime(0, 0, 0, 7, 31, 1960)), "\n";
?>

 [2006-05-31 09:16 UTC] martin at whitewallweb dot com
Thanx will update now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 08:01:35 2024 UTC