Hello everyone,
Using shinobi charts the X-Axis returns a NSNumber to me. This number needs to be converted to a double so i can use it in an NSDATE.FromTimeIntervalSince1970(); method.
The code i have written runs perfectly on an iPad 2 Wi-Fi + 3G (GSM), but goes crazy on an iPad Wi-Fi + 4G (LTE/GSM). Note: Both ipads are running on software version 6.1.3 (10B329).
The code is as followed.
string s = chart.XAxis.AxisRange.Minimum.ToString();
Decimal dec = Convert.ToDecimal (s);
NSDate d = NSDate.FromTimeIntervalSince1970 (Convert.ToDouble(dec));
Console.WriteLine ("Original number: "+chart.XAxis.AxisRange.Minimum.ToString());
Console.WriteLine ("Parsed decimal: "+dec);
Console.WriteLine ("Parsed double: " + Convert.ToDouble(dec));
NSDateFormatter formatter = new NSDateFormatter ();
formatter.DateFormat = "MMMM/dd/yyyy";
NSString dateString = new NSString (formatter.ToString (d));
Console.WriteLine (dateString);
This is what the console outputs on the iPad Wi-Fi + 4G (LTE/GSM):
Original number: 1317729615.037777
Parsed decimal: 1317729615037777
Parsed double: 1,31772961503778E+15
december/20/5828963
This is what the console outputs on the iPad 2 Wi-Fi + 3G (GSM):
Original number: 1318842940.134849
Parsed decimal: 1318842940.134849
Parsed double: 1318842940.13485
October/17/2011
As you see the numbers are not exactly the same, this is because the code is running while the chart is being dragged/zoomed. But i already tried the exact same numbers and the results were the same as above.
Now either i am parsing this completely wrong or the hardware on the devices seem to run the parsing code a little differently.
The question now is, how can i solve this issue as?
Greetings, Kami