Date exception when trying to use date method
- by Simon Andi
Hi,
I have defined a object model where one of the array elements is a string
public static String[] columnNames6
= {"Total Shares",
"Total Calls",
"Call Strike",
"Call Premium",
"Call Expiry"
};
public static Object[][] data6
= {
{ new Double(0), new Double(0), new Double(0), new Double(0),"dd/mm/yyyy"},
};
I then use the following code to get the date so that I can use the data method but having
no joy - Can someone please tell me why it is throwing an exception after I do this
String ExpiryDate = (String)GV.data6[0][4];
System.out.println("DATE STRING IS: " + ExpiryDate);
Date EndOptionDate = new Date(ExpiryDate); // SOMETHING WRONG HERE even though it compiles okay
//Get Todays's Date
Date TodaysDate = new Date();
//Calculate Days Option Expiry
long DaysDifference = EndOptionDate.getTime() - TodaysDate.getTime();
Would really appreciate some help as really stuck not sure how I should code the
line in bold - new to java, so please excuses my lack of knowledge looked at tutorials
can't seem to move forward.
Thanks
Simon