Date exception when trying to use date method

Posted by Simon Andi on Stack Overflow See other posts from Stack Overflow or by Simon Andi
Published on 2011-01-07T15:40:08Z Indexed on 2011/01/07 15:53 UTC
Read the original article Hit count: 356

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about date