-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: timestamp in servlet
PostPosted: Mon Mar 30, 2009 3:26 am 
Newbie

Joined: Thu Mar 26, 2009 4:41 am
Posts: 2
I have defined 1 column in table as Created_On with type as timestamp.
Now, when in servlet i am writing sad.setACreatedOn(timeStamp);
sad is the object.

Even on writing it in try-catch block:-

timestampDate = request.getParameter("timestamp");

try{
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

Date dob = (Date)formatter.parse(date);
Date timeStamp = (Date)formatter.parse(timestampDate);
sad.setDob(dob);
sad.setACreatedOn(timeStamp);
sad.setALastUpdatedOn(timeStamp);
} catch (ParseException pe){
log.error(pe.getMessage());
log.error(pe.getLocalizedMessage());
}
catch(Exception e)
{
log.error(e.getMessage());
}

It is giving error.
Is it the Correct way?
Give suggestions


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.