Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to solve Warning: mktime ?????

Discussion in 'General Discussion' started by neomas, Apr 15, 2008.

  1. neomas

    neomas Registered

    Joined:
    Apr 4, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    I just move hosting from USA server to Thailand server.
    But error on script ( PHP my invoice)

    Warning: mktime() expects parameter 6 to be long, string given in /home/pickmeea/public_html/receipt/inc/date.php on line 15

    I don't know to solve this problem
    This's date.php in inc folder
    <?
    function fixDate($val)
    {
    $dateArray = explode("-", $val);
    $val = date("M j, Y", mktime(0,0,0, $dateArray[1], $dateArray[2], $dateArray[0]));
    return $val;
    }
    $year = date (Y);
    $mon = date (m);
    $day = date (d);
    $today = $year."-". $mon."-". $day;

    $year = date (Y);
    $mon = date (m)+1;
    $day = date (d);
    $p_due = $year."-". $mon."-". $day;

    $lyear = date (Y)-1;
    $lmon = date (m);
    $lday = date (d);
    $lastyear = $lyear."-". $lmon."-". $lday;

    //--------day of year-----------------------
    $dayofyear2 = date('z');
    //-----------get year only-----------------
    $dateyear = date('Y', $unix_time);
    //-------days in a month------------------
    $days_per_month = date('t', $unix_time);
    //-------week number of year starts monday--------------
    $date_week_number = date('W', $unix_time);
    //------get the begining of year date---------------------
    $ago = $dayofyear2; // days
    $ytda = time() - ($ago * 86400);
    $ytd = date("Y-m-d", $ytda);

    ?>
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,761
    Likes Received:
    116
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    It would really depend on what the value of $dateArray[0] is. Without knowing that, there's not a lot of help that can be provided.

    You really probably want to ask this at a more PHP oriented board. This forum is intended for cPanel specific information. You might check out phpbuilder.com I think they have a forum.

    You might also review the mktime() function from the PHP website:

    http://us3.php.net/manual/en/function.mktime.php
     
  3. soundguy

    soundguy Well-Known Member
    PartnerNOC

    Joined:
    Oct 29, 2003
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    seattle
    I've been running into this a lot this week. I'm moving some sites from an old server running Centos 4.1 and PHP 4.x to Centos 5.1 and PHP 5.x. I think the new version of PHP must have jacked up the type enforcement or something.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    3
    Trophy Points:
    168
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    This might have to do with the way dates are formatted in different locales. USA is mm/dd/yyyy. Is the box in Thailand using dd/mm/yy?
     
  5. ckh

    ckh Well-Known Member

    Joined:
    Dec 6, 2003
    Messages:
    358
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    Phoenix, AZ
    cPanel Access Level:
    DataCenter Provider
    parameter 6 is the year. If $dateArray[0] contains something other then numbers, the variable is going to be a string. It should contain either a two digit or 4 digit number.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice