php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17335 mktime() Off by One?
Submitted: 2002-05-21 10:28 UTC Modified: 2002-05-21 11:34 UTC
From: hz11 at nyu dot edu Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.1 OS: Linux
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: hz11 at nyu dot edu
New email:
PHP Version: OS:

 

 [2002-05-21 10:28 UTC] hz11 at nyu dot edu
In the array returned from localtime(), tm_mon starts from 0.  However, the month field in mktime() starts from 1.  Is there the way it is in C, or is this a PHP implementation bug?

Thanks,

Hans


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-21 11:34 UTC] hholzgra@php.net
localtime() mimics the C behaviour which is zero-based
while mktime() is for humans and has no C counterpart,
so it uses the more convenient 1-based stuff

just use getdate() instad of localtime() and you'll
be fine
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC