• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Using Timestamp in Database Application

 
Ranch Hand
Posts: 2201
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2201
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic