aspose file tools*
The moose likes JDBC and the fly likes Date / Time problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Date / Time problems " Watch "Date / Time problems " New topic
Author

Date / Time problems

john ersan
Greenhorn

Joined: Dec 24, 2005
Posts: 10
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 !


Good Coding...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
Instead of using getDate, have you looked at what getTime and getTimestamp return?


Ping & DNS - my free Android networking tools app
john ersan
Greenhorn

Joined: Dec 24, 2005
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
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

Joined: Dec 24, 2005
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
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

Joined: Dec 24, 2005
Posts: 10
thanx

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

thx again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date / Time problems