This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Java in General and the fly likes Using Timestamp in Database Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using Timestamp in Database Application" Watch "Using Timestamp in Database Application" New topic

Using Timestamp in Database Application

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
My application records inspection records. When the user types in an inspection record document number and the app attempts to validate it I store a timestamp to a servlet attribute as follows:

Then when the record is submitted I send this value to my connection class as follows:

In my connection class I have:

I get this error in the console

SamplingInspectionConnection1:PE: java.text.ParseException: Unparseable date: "2010-11-12 05:52:35.038"
Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
You didn't give much info but I can say that

works just fine for me on 1.6.0_22.
Are you sure about the value and format being passed in?
What line number does the stacktrace report the Exception on?
Is it where you call Timestamp.valueOf(String); ?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1543
After looking at this again I realized I did not need to use the:

So I use the string parameter sent to the class directly in the:

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Using Timestamp in Database Application
It's not a secret anymore!