Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.util.Calendar problem.

 
shyam ramineni
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
shyam ramineni
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me with this issue.

Thanks
Shyam Ramineni
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15483
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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").
 
shyam ramineni
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you set the date like this?

[ August 26, 2006: Message edited by: Rene Larsen ]
 
shyam ramineni
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic