php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38777 get a day in the future
Submitted: 2006-09-11 07:15 UTC Modified: 2006-09-11 07:27 UTC
From: magnus at ronnerup dot se Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.4.4 OS: linux (unknown dist.)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: magnus at ronnerup dot se
New email:
PHP Version: OS:

 

 [2006-09-11 07:15 UTC] magnus at ronnerup dot se
Description:
------------
It doesnt count to the right day. could be a summer/wintertime bug?

Reproduce code:
---------------
$order["journey_stay_first"] = 1161900000;

$adddays = $order["journey_stay_first"] + ( $_GET["x"] * 24 * 60 * 60);    
$journey_first_stay_date = date('ymd', $order["journey_stay_first"]);
$journey_last_stay_date = date('ymd', $adddays); 

Expected result:
----------------
$order["journey_stay_first"] = 1161900000;
x, start, end:
0, 06 10 27 12:00:00, 06 10 27 12:00:01
1, 06 10 27 12:00:00, 06 10 28 12:00:01
2, 06 10 27 12:00:00, 06 10 29 12:00:01
3, 06 10 27 12:00:00, 06 10 30 11:00:01
4, 06 10 27 12:00:00, 06 10 31 11:00:01

Actual result:
--------------
$order["journey_stay_first"] = 1161900000;
x, start, end:
0, 06 10 27 12:00:00, 06 10 27 12:00:01
1, 06 10 27 12:00:00, 06 10 28 12:00:01
2, 06 10 27 12:00:00, 06 10 29 12:00:01
3, 06 10 27 12:00:00, 06 10 29 11:00:01
4, 06 10 27 12:00:00, 06 10 30 11:00:01

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-11 07:27 UTC] johannes@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

You are not adding days but seconds as an offset.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 10:01:30 2025 UTC