This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes required format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "required format " Watch "required format " New topic
Author

required format

Naresh Babu
Greenhorn

Joined: Mar 20, 2001
Posts: 29
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).]
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
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

Joined: Mar 20, 2001
Posts: 29
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).]

 
GeeCON Prague 2014
 
subject: required format