Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Warning: mktime() expects parameter 1 to be long, string given in xxxxxx

    Buongiorno a tutti,
    ho il sito in locale con su xampp e avrei un problema che mi dà questo errore ma non riesco a individuare dove effettuare la modifica:

    Warning: mktime() expects parameter 1 to be long, string given in C:\xampp\htdocs\include\funzioni.inc.php on line 583

    la funzione è questa:

    codice:
      function operation($operator,$date,$operand)
        {
            $ts = mktime("", "", "", substr($date,3,2), substr($date,0,2), substr($date,6,4));
    
            $t=explode('%',$operand);
            $how=$t[0];
    
            switch($t[1])
            {
                case 'D':
                {
                    if($operator=='+' || $operator=='sum' || $operator=='add')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts),date('d',$ts)+$how,date('Y',$ts)));
                    }
                    elseif($operator=='-' || $operator=='sub' || $operator=='sot')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts),date('d',$ts)-$how,date('Y',$ts)));
                    }
                    break;
                }
                case 'M':
                {
                    if($operator=='+' || $operator=='sum' || $operator=='add')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts)+$how,date('d',$ts),date('Y',$ts)));
                    }
                    elseif($operator=='-' || $operator=='sub' || $operator=='sot')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts)-$how,date('d',$ts),date('Y',$ts)));
                    }
                }
                case 'Y':
                {
                    if($operator=='+' || $operator=='sum' || $operator=='add')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts),date('d',$ts),date('Y',$ts)+$how));
                    }
                    elseif($operator=='-' || $operator=='sub' || $operator=='sot')
                    {
                        return date("d/m/Y",mktime(0,0,0,date('m',$ts),date('d',$ts),date('Y',$ts)-$how));
                    }
                    break;
                }
            }
        }
    alla riga segnalata, cioè la 583 c'è scritto questo:
    codice:
      $ts = mktime("", "", "", substr($date,3,2), substr($date,0,2), substr($date,6,4));
    Potete aiutarmi per cortesia ?
    Vi ringrazio anticipatamente
    Beppewhyte

  2. #2
    Il messaggio di errore e' chiaro: la funzione si aspetta un numero e tu le dai una stringa, per quanto vuota:

    codice:
    mktime(0, 0, 0, ...)

  3. #3
    OK grazie ora provo e poi ti dico

  4. #4
    Grazie MILLE funziona.
    Sei stato mitico.
    Beppewhyte

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.