Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java.util.Calendar problem.

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone help me with this issue.

Thanks
Shyam Ramineni
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic