• 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

required format

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In my class , the code :
String q1 ="select to_char(startdate , 'dd/mm/yy hh:mi:ss') from emp";

Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(q1);
while(rs.next())
{
System.out.printl(rs.getString(1));
}

The o/p: 2001-01-20 10:00:00 .
But, shouldnt it print 20/01/01 10:00:00 since i am getting the column value using rs.getString(x) and also in query i am
using to_char(x,x) for the required format.
Do i have to set some values at the java side .
I am using oracle JDBC driver.
Any help is appreciated.
thanks
Naresh.


[This message has been edited by Naresh Babu (edited April 28, 2001).]
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This isn't to answer your question but ...one thing
in Oracle you use hh24 if you want the hour to be 10 (am) or 22 (pm). Otherwise it would be 10 for either am or pm
Dan
 
Naresh Babu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyone please suggest me a way ...
thanks

Originally posted by Naresh Babu:
Hi,
In my class , the code :
String q1 ="select to_char(startdate , 'dd/mm/yy hh:mi:ss') from emp";

Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(q1);
while(rs.next())
{
System.out.printl(rs.getString(1));
}

The o/p: 2001-01-20 10:00:00 .
But, shouldnt it print 20/01/01 10:00:00 since i am getting the column value using rs.getString(x) and also in query i am
using to_char(x,x) for the required format.
Do i have to set some values at the java side .
I am using oracle JDBC driver.
Any help is appreciated.
thanks
Naresh.


[This message has been edited by Naresh Babu (edited April 28, 2001).]


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic