0

i build website that generate report for which i make a html form give two field start date time and end date time as input and get date time through name attribute to another php page named report.php here i convert date time in seconds through strtotime(); and pass in url in url i give timezone=Asia/Calcutta.but i got the warning message like this-

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /var/www/html/vts/vehicalreport.php on line 232 Warning: strtotime():

my html form is given below

    <!DOCTYPE html>
<html>
<head>

</head>
<body>
    <form  name ="reportform"  action="vehicalreport.php" method="get" rel="external" data-ajax="false">

         <label for="fromDate">Select From Date-Time</label>
             <input type="datetime-local" data-clear-btn="true" name="fromDate" id="fromDate" value="" required= "required" >
            <label for="toDate">Select To  Date-Time</label> 
              <input type="datetime-local" data-clear-btn="true" name="toDate" id="toDate" value="" required= "required" >

              <input id="view" type="submit" data-theme="b" value="View Report" rel="external">


        </form>
 </body>

   </html>

php code get Date time from html and put in strtotime an pass in url

     $fromDate =$_GET["fromDate"];
     $toDate = $_GET["toDate"];
 $_SESSION['from']= strtotime($fromDate);
 $_SESSION['to']= strtotime($toDate);


     $data = array('a' =>$_SESSION['account'], '&u' =>$_SESSION['username'],'&p'
 =>$_SESSION['password'],'&d'=>$_SESSION['uniqueid'],'&tz'=> 'Asia/Calcutta','&rf'=>$_SESSION['from'],'&rt'=>$_SESSION['to'],'&limit'=>'10');
      echo curlUsingGet('http://"url":8080/events/data.json',$data);

2 Answers2

0

Add this in the beginning of your code:

date_default_timezone_set('timezone');

You have to get your timezone here: http://de3.php.net/manual/en/timezones.america.php

Realitätsverlust
  • 3,941
  • 2
  • 22
  • 46
0

You need to set your server's date.timezone zone in your php.ini.

Depending on your system setup, this file can be found at different locations.

db-mobile
  • 306
  • 2
  • 8