I'm using the flot graphing library for jQuery, and it uses javascript time for any time series (to remind, that's milliseconds since Jan 1970. Unix time is seconds).
My current code looks like this:
foreach($decoded['results'] as $currentResult) {
if($currentResult['from_user'] == $user) {
$strippedTexts = $currentResult['created_at'];
$dates []= strtotime($strippedTexts);
}
}
This gives me an array of Unix time stamps. I want to prep the data for JavaScript in the loop, but when I try
$dates []= 1000*strtotime($strippedTexts);
the number is too big and it spits out "[-2147483648]". Do I need to change the "type" of variable allowed to be held in the array to bignum or something?
Thanks!
You can try using the BCMath Arbitrary Precision functions if you have them available:
$dates[] = bcmul("1000", strtotime($strippedTexts));
Or just, you know, append three zeros on the end.
$dates[] = strtotime($strippedTexts).'000';
In both cases you'll end up with the value being stored as a string, but that shouldn't matter for your usage.