I'm trying to come up with SimpleDateFormat pattern to parse and format JDBC timestamps, in particular dates in the following format yyyy-mm-dd hh:mm:ss.fffffffff, where ffffffffff indicates nanoseconds. 
Unfortunately new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS000000") does not work, the following exception is thrown: 
java.text.ParseException: Format.parseObject(String) failed
Is this possible with SimpleDateFormat at all, or I have to create a custom subclass of java.text.DateFormat to handle this case? Please note that it's not a question on how to parse yyyy-mm-dd hh:mm:ss.fffffffff string in Java, I'm interested in a declarative approach, i.e. SimpleDateFormat pattern which does not require additional modifications of the input string .
Example:
I expect the input 2012-02-05 17:00:34.427000000
to be parsed as java.util.Date where milliseconds part is 427.
Here is a list of formats I've tried so far and they all failed for various reasons:
- new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS000000")-- java.text.ParseException: Format.parseObject(String) failed
- Both new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSSSSS", Locale.US)andnew SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US)- are parsed as Fri Feb 10 15:37:14 rather than expected one Sun Feb 05 17:00:34. (The nanoseconds part of 427000000 is treated as milliseconds, even if only SSS is specified)
 
     
     
    