php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #608 date returning "His" in strange order?
Submitted: 1998-08-02 11:57 UTC Modified: 1998-08-03 11:24 UTC
From: kk at shonline dot de Assigned:
Status: Closed Package: Performance problem
PHP Version: 3.0.2a OS: Solaris 2.5.1
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: kk at shonline dot de
New email:
PHP Version: OS:

 

 [1998-08-02 11:57 UTC] kk at shonline dot de
webuser@poe ~ $ ../cgi/php -v
3.0.2a
webuser@poe ~ $ ../cgi/php   
<?php
$timeout = mktime(date("s"), date("i"), date("H"),
                   date("m"), date("d"), date("Y"));
$sqldate = date("YmdHis", $timeout-1440*60);
print $sqldate;
Content-type: text/html
 
19980802025317
$timeout = mktime(date("s"), date("i"), date("H"),
                 date("m"), date("d"), date("Y"));
$sqldate = date("YmdHis", $timeout-1440*60);
print $sqldate;
19980802055317
webuser@poe ~ $ date
Sun Aug  2 17:53:32 MET DST 1998

As you can see, I coded YmdHis, but I get YmdsiH. How come?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-03 11:24 UTC] rasmus
You are feeding arguments to mktime in sec/minute/hour/month/day/year format when the function is defined to take hour/minute/sec/month/day/year, so it is entirely expected that your "His" comes out as "siH" since that is the order you provided to mktime().  So, no PHP bug here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 09:01:27 2025 UTC