I'm writing a program where I need to pass the java.sql.date in the constructor. When I started to test this code, it would not compile because of the format of the date. This is the format that I used:
January 1, 2000 01:01:01.001
The compiler does not like this format. I tried taking out spaces and that didn't work. I shouldn't take out the other symbols, should I? What format should the java.sql.date be in when passed to a constructor.
Thanks!
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
posted
0
According to the API docs for 1.5, there is only one constructor of java.sql.Data (that is recommended. There is one that is deprecated). It accepts a long.
Adrienne Peck
Greenhorn
Joined: Jul 10, 2006
Posts: 29
posted
0
I tried to put that date in as a long. However, eclispe states that the number should be an integer. So, I can put in the CCYYMMDDHH just fine. Not able to put in minutes and seconds.
How can the java.sql.Date object be an integer? Does this mean that something else needs to happen once that value is passed in?
I was thinking of doing the following with the date that is passed in: