| Author |
java.util.Calendar problem.
|
shyam ramineni
Ranch Hand
Joined: Jul 08, 2005
Posts: 43
|
|
Hi, I am invoking a WebService which sets TimeStamp field in DataBase. The Application is running on App Server which is located in US, and I am sitting in India. When I use The Database field whose type is TimeStamp, is getting populated as Aug 17, 2006 12:00:00 AM 191000. Idealy this should be Aug 17, 2006 12:00:00 AM 000000. Can anyone tell me why these extra millisecs are getting added and what should I do for the database entry to be Aug 17, 2006 12:00:00 AM 000000. Thanks Shyam Ramineni.
|
<a href="http://hyderabaditeducation.com" target="_blank" rel="nofollow">http://hyderabaditeducation.com</a>
|
 |
shyam ramineni
Ranch Hand
Joined: Jul 08, 2005
Posts: 43
|
|
Can anyone help me with this issue. Thanks Shyam Ramineni
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
How are you getting the timestamp from the database? Show us the code that you use to get the timestamp from the database and how you print it on screen (how you're formatting the Timestamp object to the string "Aug 17, 2006 12:00:00 AM 191000").
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
shyam ramineni
Ranch Hand
Joined: Jul 08, 2005
Posts: 43
|
|
How are you getting the timestamp from the database? >> I am not retrieving timestamp data from the database. I have access to database. So I am querying to know what is populated in Database field after I invoke the webservice. We are using thrid party application and, we don't have access to its code. I am invoking webservice in this application which sets the set timestamp field in database. The timestamp field value must be set to "Aug 17, 2006 12:00:00 AM 00000" for Application logic to fire correctly. But when I execute code, that I have posted before its adding extra 191 milli secs in database ie "Aug 17, 2006 12:00:00 AM 191000". So I have figure out a way to enter time without those milli secs. Thanks Shyam Ramineni
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
What if you set the date like this? [ August 26, 2006: Message edited by: Rene Larsen ]
|
Regards, Rene Larsen
Dropbox Invite
|
 |
shyam ramineni
Ranch Hand
Joined: Jul 08, 2005
Posts: 43
|
|
Hi Rene, Its working. The above code is populating Database field correctly. Can you please tell me what was wrong with my code. Thanks Shyam
|
 |
shyam ramineni
Ranch Hand
Joined: Jul 08, 2005
Posts: 43
|
|
Hi Rene, Its working. The above code is populating Database field correctly. Can you please tell me what was wrong with my code. Thanks Shyam
|
 |
Rene Larsen
Ranch Hand
Joined: Oct 12, 2001
Posts: 1179
|
|
Originally posted by shyam ramineni: Hi Rene, Its working. The above code is populating Database field correctly. Can you please tell me what was wrong with my code. Thanks Shyam
I've tried to set the date like you did - and it works for me - millisecs are 00000. So, no I don't know what is wrong with your code - but the way I set the date, the date will be completely reset - and it won't the way you did. Have you tried to call 'clear()' on the Calendar before you try to set the date? It should clear the values of all the time fields. [ September 05, 2006: Message edited by: Rene Larsen ]
|
 |
 |
|
|
subject: java.util.Calendar problem.
|
|
|