• 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

Date / Time problems

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 !
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanx

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

thx again
 
reply
    Bookmark Topic Watch Topic
  • New Topic