• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubts in setDate(i,date,cal) API of preparedStatement

 
Vinney Shanmugam
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This is code should insert date = 1999-05-05 to the table in the database or the current date, when the this program is executed?
I am not clear about how the code for setDate(1,date,cal) is implemented. How significantly, the calendar object helps in setting date?
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error are you getting ?

Check out my code below

 
Vinney Shanmugam
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ujjwal.... thanks for the reply. But, my doubt is on setDate(1,date,calendar) and your program is about setDate(1,date), which i am not interested in.

If you could please explain me about setDate(1,date,cal) API.... thanks a lot for the reply though.....!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
explorer vinney wrote:How significantly, the calendar object helps in setting date?

It's for the time zone. In your example, it's not much use for two reasons:
1) There isn't a time
2) The date and calendar refer to the same object
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic