Question : Convert String MM/dd/yyyy hh:mm:ss to Milliseconds in Java

I need to know if there is a way to convert a string in MM/dd/yyyy hh:mm:ss format to its equivalent in milliseconds (Epoch time) in Java?  I have a string in this format that I need to convert to milliseconds so I can send the converted value through my program that requires the time to be in this format.  Any help would be appreciated.  

Answer : Convert String MM/dd/yyyy hh:mm:ss to Milliseconds in Java

I was able to resolve my issue by using the following try...catch block.  I attempt to parse the string as a long and if that fails then parse the string as a date.

 Date localDate = new Date();
        try
        {
          localDate.setTime(Long.parseLong(paramString));
        }
        catch (NumberFormatException localNumberFormatException)
        {
          localDate.setTime(Date.parse(paramString));
        }
Random Solutions  
 
programming4us programming4us