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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC