php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18177 Second argument to strtotime has no effect
Submitted: 2002-07-05 05:42 UTC Modified: 2002-07-05 05:43 UTC
From: ph at cpen dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.1 OS: w2k
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: ph at cpen dot com
New email:
PHP Version: OS:

 

 [2002-07-05 05:42 UTC] ph at cpen dot com
The second argument for strtotime seems to have no effect.
strtotime("2001-02-02 12:01:01",500);
strtotime("2001-02-02 12:01:01",1000);
strtotime("2001-02-02 12:01:01",time());
strtotime("2001-02-02 12:01:01");
all gives the same output.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-05 05:43 UTC] derick@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2004-10-11 07:23 UTC] kwils13 at hotmail dot com
I've experienced the same thing (redhat)

int strtotime ( string time [, int now])

... will try to parse that format into a Unix timestamp RELATIVE TO THE TIMESTAMP GIVEN IN NOW, OR THE CURRENT TIME IF NONE IS SUPPLIED. (sorry wasn't sure how else to give emphasis)

echo date("m/d/Y h:i:s",time());
#result: 10/10/2004 10:14:31

echo date("m/d/Y h:i:s",strtotime("+ 1 hour", time()));
#result: 10/10/2004 01:00:00
#expected: 10/10/2004 11:14:31

echo date("m/d/Y h:i:s",strtotime("+ 1 hour"));
#result: 10/10/2004 01:00:00
#expected: 10/10/2004 11:14:31

it appears that strtotime always returns the date at midnight (00:00:00) and is in fact, not relative to the timestamp given in now or the current time if none is supplied.  Suggesting that the second argument seems to have no effect.
 [2004-10-11 19:58 UTC] kwils13 at hotmail dot com
I checked at work and strtotime works properly on php 4.3.3 (also redhat).  However at home I'm using 5.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 18 08:01:27 2024 UTC