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
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 + 22 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 19 06:01:25 2020 UTC