It is currently Sun Oct 26, 2014 6:25 am Advanced search

Issue with Dates

Technical support for the Highcharts Stock package

Issue with Dates

Postby gparaggio » Fri Feb 10, 2012 4:13 pm

Hallo everybody,
i have this problem:

- i am using code igniter and mysql DB to view/store my datas, they are quotation of gold coins. They are stored like a pair of (date,value)
- with codeIgniter i am able to get them from mysql, but the date are in a form like "2011-11-03"

My code is something like:

Code: Select all
$data = array();
      foreach($golds as $single)
      {
         $value = $single->Value; // value is 287.15, correct
         $dateStr = ($single->Data); // here is "2011-11-03" correct!
         $dateTime = floatval ( strtotime($dateStr) ) ; // here is 1320274800 correct!
         $dateTimeEn = ($dateTime)*1000;     // here is 1320274800000 correct!
         $data[($dateTimeEn)] = ($value);
      }

print_r ($data);


Array ( [1719840128] => 287.15 ETC... // WRONG!!! 1719840128 is not 1320274800000

I know that i have to multiply by 1000 the epoch time that i get from the method strtotime
the problem is that the value multiplied by 1000 exceed the limit of php ...so i am not able to build a correct array ( i have things weird like negative keys...)

How to solve it?
Thanks in advance!

Giuseppe
gparaggio
 
Posts: 4
Joined: Fri Feb 10, 2012 4:03 pm

Re: Issue with Dates

Postby gparaggio » Mon Feb 13, 2012 10:35 am

no ideas? :)

Giuseppe
gparaggio
 
Posts: 4
Joined: Fri Feb 10, 2012 4:03 pm

Re: Issue with Dates

Postby hfrntt » Sat Feb 18, 2012 2:19 am

Have you tried to use other function than strtotime? i'm not a php guru but I belive that there should be a simple way to store large numbers.
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am


Return to Highstock Usage

Who is online

Users browsing this forum: No registered users and 4 guests