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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 - 21 = ?
Subscribe to this entry?

 
 [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: Sat May 04 16:01:31 2024 UTC