• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date / Time problems

 
john ersan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys..

I'd like to ask how to get full Date and Time from mssql with jdbc?

for eg.




this datex only takes Date from the database ..

but, in database there is also time too..

how can i take both of it ?

thanx for ur time !
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using getDate, have you looked at what getTime and getTimestamp return?
 
john ersan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i checked..

and the problem is when i use them they say No data found

in mssql , my data is stored as DateTime

for e.g.



if someone can give me a link or code it would be great..

thx 4 ur time..!
[ January 12, 2006: Message edited by: john ersan ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not too familiar with the JDBC/ODBC bridge - is there any particular reason you couldn't use a better driver like jTDS?
 
john ersan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not really..

i didnt even know a better driver exists called jtds..

I'm really rookie about java, i've been coding with it almost for two months by now..

I'm done with my grad. project that i had to use java for some oop metrics.. the last thing i have to do is;
get the Time from mssql / DateTime field and put it into a JTextField and do some inheritance between classes.. I'm stuck
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to go the jTDS route, and getTime[stamp] really doesn't work with the JDBC/ODBC bridge, you could use getString, which returns the date and time as a string. You can then parse the string to extract the date and time yourself.
 
john ersan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx

i just get it as a string and put into JTextField with substring();

thx again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic