Timestamp problem

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Timestamp problem

      Hi,
      I have problem.
      I have been looking for a solution for hours.
      I would like to know where to look for the problem then I will solve it myself. Someone help?

      Source Code

      1. [05-Sep-2020 22:52:57] Error signature: 4_5f53faa9ed5934.36033350WARNING: "DateTime::setTimestamp() expects parameter 1 to be integer, float givenFile: /home/game/www/uni2/includes/GeneralFunctions.php | Line: 143
      2. URL: https://uni2.game.pl/game.php?page=buildings&cp=8312 | Version: 1.9.6i
      3. Stack trace:
      4. #0 [internal function]: errorHandler(2, 'DateTime::setTi...', '/home/sgame/www...', 143, Array)
      5. #1 /includes/GeneralFunctions.php(143): DateTime->setTimestamp(2.490310450139E+19)
      6. #2 /includes/pages/game/ShowBuildingsPage.class.php(301): _date('U', 2.490310450139E+19, 'Europe/Warsaw')
      7. #3 /includes/pages/game/ShowBuildingsPage.class.php(341): ShowBuildingsPage->getQueueData()
      8. #4 /game.php(56): ShowBuildingsPage->show()
      9. #5 {main}

      The post was edited 1 time, last by m4ti ().

    • First of all, it’s not a mysql issue. Secondary we need to see the code which causes this issue.

      It looks like you are giving the wrong Formate of the requested variable but like said, we need to see your code to fix this.
    • Source Code: GeneralFunction.php

      1. function _date($format, $time = null, $toTimeZone = null, $LNG = NULL)
      2. {
      3. if(!isset($time))
      4. {
      5. $time = TIMESTAMP;
      6. }
      7. if(isset($toTimeZone))
      8. {
      9. $date = new DateTime();
      10. if(method_exists($date, 'setTimestamp'))
      11. { // PHP > 5.3
      12. $date->setTimestamp($time);
      13. } else {
      14. // PHP < 5.3
      15. $tempDate = getdate((int) $time);
      16. $date->setDate($tempDate['year'], $tempDate['mon'], $tempDate['mday']);
      17. $date->setTime($tempDate['hours'], $tempDate['minutes'], $tempDate['seconds']);
      18. }
      19. $time -= $date->getOffset();
      20. try {
      21. $date->setTimezone(new DateTimeZone($toTimeZone));
      22. } catch (Exception $e) {
      23. }
      24. $time += $date->getOffset();
      25. }
      26. $format = locale_date_format($format, $time, $LNG);
      27. return date($format, $time);
      28. }
      Display All
      @XenQen
    • Well, I need the code where you call the _date function. As you pass the time variable over the function, I need to see the variable where it’s called. Because if it’s not set, you use a time stamp and that will probably work. Otherwise you can also add me in discord: zbder#0541
    • XenQen wrote:

      Well, I need the code where you call the _date function. As you pass the time variable over the function, I need to see the variable where it’s called. Because if it’s not set, you use a time stamp and that will probably work. Otherwise you can also add me in discord: zbder#0541
      Hi, I cant add you on discord. You have blockade to add new friends. Can you help me here?
      I still have this error