parsing with timezone - Convert Java String to sql.Timestamp
You could use
Timestamp.valueOf(String). The documentation states that it understands timestamps in the format
yyyy-mm-dd hh:mm:ss[.f...], so you might need to change the field separators in your incoming string.
Then again, if you're going to do that then you could just parse it yourself and use the
setNanos method to store the microseconds.
Got a String coming in with this format: YYYY-MM-DD-HH.MM.SS.NNNNNN The Timestamp is coming from a DB2 database. I need to parse it into a java.sql.Timestamp and NOT lose any precison. So far I've been unable to find existing code to parse that far out to microseconds. SimpleDateFormat returns a Date and only parses to milliseconds. Looked at JodaTime briefly and didn't see that would work either.