Advertisement

05.07.2008 at 06:08PM PDT, ID: 23384759 | Points: 500
[x]
Attachment Details
how to get the result  orderby date
Hi mike

kindly help in solving the problem wich is related to the existing one ,

you solved for me to get the values which is  equal to today date ,
now the results are coming in the the random order , how can i get the vales orderby date
attached my sample output.

kindly help in solving
 thank you
with regards
jeevanjosh

 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
Util.java
 
public static int getCompareResult2(String date) throws ParseException {      
			DateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
			df.setLenient ( false );
           
			DateFormat df1 = new SimpleDateFormat("EEE MMM dd kk:mm:ss zzz yyy", Locale.getDefault());
			df1.setLenient ( false );      
			  
			Date d1= df.parse(date);
			Date now = df1.parse(new Date().toString());
        		
			Calendar today = Calendar.getInstance(Locale.getDefault());
			today.setTime(now);
			Calendar compare = Calendar.getInstance(Locale.getDefault());
			compare.setTime(d1);
        
			compare.set(Calendar.HOUR_OF_DAY, 0);
			compare.set(Calendar.MINUTE, 0);
			compare.set(Calendar.SECOND, 0);
			compare.set(Calendar.MILLISECOND, 0);
        
			today.set(Calendar.HOUR_OF_DAY, 0);
			today.set(Calendar.MINUTE, 0);
			today.set(Calendar.SECOND, 0);
			today.set(Calendar.MILLISECOND, 0);
                    
			if (today.equals(compare)) {
				return 0;
			} else if(today.before(compare)) {
				return -1;
			} else {
				return 1;
			} 
			
			
	}
Attachments:
 
sample output
 
 
roombooking table
 
Start your free trial to view this solution
Related Solutions: how to get today value"
Question Stats
Zone: Web Development
Question Asked By: Jeevanjosh
Question Asked On: 05.07.2008
Participating Experts: 2
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.07.2008 at 09:52PM PDT, ID: 21522404

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 11:30PM PDT, ID: 21522683

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 11:35PM PDT, ID: 21522699

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 11:48PM PDT, ID: 21522749

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.07.2008 at 11:57PM PDT, ID: 21522790

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:09AM PDT, ID: 21522826

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:14AM PDT, ID: 21522851

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:17AM PDT, ID: 21522862

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:18AM PDT, ID: 21522872

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:22AM PDT, ID: 21522897

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:28AM PDT, ID: 21522913

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:38AM PDT, ID: 21522952

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:49AM PDT, ID: 21523007

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:53AM PDT, ID: 21523016

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:55AM PDT, ID: 21523020

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 12:58AM PDT, ID: 21523031

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:04AM PDT, ID: 21523042

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:16AM PDT, ID: 21523088

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:40AM PDT, ID: 21523194

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 01:49AM PDT, ID: 21523228

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 02:01AM PDT, ID: 21523264

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 10:39PM PDT, ID: 21530579

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.08.2008 at 11:20PM PDT, ID: 21530699

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 12:35AM PDT, ID: 21530944

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 02:02AM PDT, ID: 21531210

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.07.2008 at 09:52PM PDT, ID: 21522404

Rank: Genius

just need to sort by date
you can use Collections.sort(), or Arrays.sort() if you have a List or an array

 
05.07.2008 at 11:30PM PDT, ID: 21522683
Hi mike

where to use  or how can i use this function
kindly help me attached my jsp and Util.java

Thank you so much

kindly help me pls

with regards
jeevanjosh
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
Util.java
note:- this is the one you given for me  get the values > than to  todays value
 
public static int getCompareResult2(String date) throws ParseException {      
			DateFormat df = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
			df.setLenient ( false );
           
			DateFormat df1 = new SimpleDateFormat("EEE MMM dd kk:mm:ss zzz yyy", Locale.getDefault());
			df1.setLenient ( false );      
			  
			Date d1= df.parse(date);
			Date now = df1.parse(new Date().toString());
        		
			Calendar today = Calendar.getInstance(Locale.getDefault());
			today.setTime(now);
			Calendar compare = Calendar.getInstance(Locale.getDefault());
			compare.setTime(d1);
        
			compare.set(Calendar.HOUR_OF_DAY, 0);
			compare.set(Calendar.MINUTE, 0);
			compare.set(Calendar.SECOND, 0);
			compare.set(Calendar.MILLISECOND, 0);
        
			today.set(Calendar.HOUR_OF_DAY, 0);
			today.set(Calendar.MINUTE, 0);
			today.set(Calendar.SECOND, 0);
			today.set(Calendar.MILLISECOND, 0);
                    
			if (today.equals(compare)) {
				return 0;
			} else if(today.before(compare)) {
				return -1;
			} else {
				return 1;
			} 
			
			
	}
  
	 
} 
Open in New Window
 
sample bookimgs
 
 
05.07.2008 at 11:35PM PDT, ID: 21522699

Rank: Genius

You will find it more efficient and convenient to sort in your query rather than in Java objects
 
05.07.2008 at 11:48PM PDT, ID: 21522749


Sorry Mike ,kindly help how and where can i use the Query is posible can i use in the below one attached

Thank you so much

with regards
jeevanjosh
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
My booking.jsp
 
<%@page import="java.util.*"%>
<%@page import="eform.util.Util"%>
<%@page import="java.util.Date"%>
<%@page import="java.sql.*"%>
<%@page import="java.sql.Statement"%>
<%@page import="javax.sql.DataSource"%>
<%@page import="javax.naming.*"%>
<%@page import="eform.beans.*"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.*"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.ParseException"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Calendar"%>
 
<%java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
Context ctx = new javax.naming.InitialContext(parms);
DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/STAFFDBS");
 
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
 
//String sql = "select date,purpose,status,rid from room_booking where DATE(date) > DATE(CURRENT TIMESTAMP)";
//String sql = "select a.date,b.time,b.rbid from time_slot from room_booking a,time_slot b where a.rbid = b.rbid ";
//String sql = "select a.date,b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = where a.rid = b.rid and a.rbid = c.rbid 
 
and status = 'Taken' and orderby date desc";
 
String sql = "select a.date,b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 
 
'Taken'";
 
 
ResultSet rs = stmt.executeQuery(sql);
    String date; 
 	String name;
	String purpose;
	String status;
	String emid;
	//int rid;
	String time;
 
	Vector records = new Vector();
	while (rs.next()){
 
	date = rs.getString("date");
	name = rs.getString("name");
	purpose = rs.getString("purpose");
	status = rs.getString("status");
	emid = rs.getString("emid");
	//rid = rs.getInt("rid");
	time = rs.getString("time");
 
 
	
try{
if(eform.util.Util.getCompareResult1(date) > 0 ){
 
 
		
	JoRoomBookingBean bean = new JoRoomBookingBean();
     bean.setDate(date);
     bean.setName(name);
     bean.setPurpose(purpose);
     bean.setStatus(status);
     bean.setEmid(emid);
     bean.setTime(time);
     
     records.addElement(bean);
     
}  
   
    }catch(Exception e){
    System.out.println("An exception occured :"+e.getMessage());
    e.printStackTrace();
   }    
   
   	//System.out.println("Joshline test here");
}
 
 %>
 
 
<head> 
<title>ROOM BOOKING LIST</title>
 
</head>
<body>
<table>
 
	<tr bgcolor="CCFFFCC">
 
        <td>DATE</td>
        <td>NAME</td>
        <td>PURPOSE</td>
        <td>STATUS</td>
        <td>EMID</td>
        <td>TIME</td>
	
   	</tr>
   	        
   		<%for (int i = 0; i < records.size(); i++) {
    	JoRoomBookingBean bean = (JoRoomBookingBean) records.elementAt(i);%>
    	
   	<tr bgcolor="FFFCCCC">
	
        <td><%=bean.getDate()%></td>
        <td><%=bean.getName()%></td>
        <td><%=bean.getPurpose()%></td>
        <td><%=bean.getStatus()%></td>
        <td><%=bean.getEmid()%></td>
        <td><%=bean.getTime()%></td>
    </tr>
    
 
<%}%>
 
 
</table>
Total Records:
<%=records.size()%>
 
</body>
</html>
 
Open in New Window
 
05.07.2008 at 11:57PM PDT, ID: 21522790

Rank: Genius

Just change:
1:
2:
3:
4:
5:
6:
>>
String sql = "select a.date,b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 'Taken'";
>>
 
to 
String sql = "select a.date,b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 'Taken' order by 1";
Open in New Window
 
05.08.2008 at 12:09AM PDT, ID: 21522826

Mike when i do that it is giving the below order

bcos  some of my table values having values for example 1/6/2008 and some having value like 01/6/2208, it is comapring the date first, as can see in the out put 01/4/2008 is shown first,

the  date type in my table room_booking is character,
attached my  table room_booking

ThankYou

with regards
Jeevan josh
 
output
 
 
table output
 
 
05.08.2008 at 12:14AM PDT, ID: 21522851

Rank: Genius

>>the  date type in my table room_booking is character

That shouldn't be the case. Dates should never be stored as strings. You need to change that or you'll run into other problems down the line too, as well as its being generally inefficient
 
05.08.2008 at 12:17AM PDT, ID: 21522862

Rank: Genius

As I mentioned above you need to sort the data once it is loaded, and not using a query.

 
05.08.2008 at 12:18AM PDT, ID: 21522872

Rank: Genius

You can use the code you already have to create a Comparator for use with the sort.

 
05.08.2008 at 12:22AM PDT, ID: 21522897
mike can you pls advice me

how to do with that ,that means the data type should be changed into date
somthing like that

if so ,how can i proceed


Thank you so much

with regards
jeevanjosh


 
05.08.2008 at 12:28AM PDT, ID: 21522913

Rank: Genius

You can get a flavour of how it should be by doing something like the following. Of course it's less efficient than storing your dates properly as i mentioned above, but still more efficient than sorting it twice, the second time in Java:
1:
String sql = "select TO_DATE(a.date, 'DD/MM/YYYY'),b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 'Taken' order by 1";
Open in New Window
 
05.08.2008 at 12:38AM PDT, ID: 21522952

Mike When i changed  the sql it is giving a Error

Error 500: The data type, length or value of argument "2" of routine "SYSIBM.TO_DATE" is incorrect.



attached my error output

Thank You so much

with regards
jeevanjosh

 
error1
 
 
05.08.2008 at 12:49AM PDT, ID: 21523007

Rank: Genius

>>if so ,how can i proceed

You need to change the date column to type TIMESTAMP
 
05.08.2008 at 12:53AM PDT, ID: 21523016

Rank: Genius

>>Mike When i changed  the sql it is giving a Error

Try the following instead:
1:
2:
3:
 
String sql = "select DATE(a.date),b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 'Taken' order by 1";
Open in New Window
 
05.08.2008 at 12:55AM PDT, ID: 21523020


Mike if change into TIMESTAMP,

will they make any effect on the other programme that is using , date field,

or it will not bcos more than 50 programmes  Aprox using  the date field

kindly need ur advice pls
 
thank you so much
with regards
jeevanjosh

 
05.08.2008 at 12:58AM PDT, ID: 21523031

Rank: Genius

Yes, it might be too late now if you have clients that are treating the date as a string. If so, leave it along and try the query as i just posted
 
05.08.2008 at 01:04AM PDT, ID: 21523042


Hi Mike it gives an error

The Website cannot display the page

attached the error


Thank you so much

with regards
jeevanjos
 
error2
 
 
05.08.2008 at 01:16AM PDT, ID: 21523088

Rank: Genius

Try the query in a console first before putting it in your code
 
05.08.2008 at 01:40AM PDT, ID: 21523194
mike  if use the sql in console

it gives the following error
SQL0181N The string representation of a datetime value is out of range.
SQLSTATE=22007

if not use the DATE(a.date) then it gives 19073 records

Kindly help in solving the problem

thank you

With best regards
jeevanjosh
 
error output
 
 
05.08.2008 at 01:49AM PDT, ID: 21523228

Rank: Genius

Try the following. You need to get the DBAs on to it
1:
String sql = "select TO_DATE(CONCAT (a.date, ' 00:00:00')),b.name,a.purpose,a.status,a.emid,c.time from room_booking a, room b, time_slot c where a.rid = b.rid and a.rbid=c.rbid and status = 'Taken' order by 1";
Open in New Window
 
05.08.2008 at 02:01AM PDT, ID: 21523264
mike It is giving an error

SQL0440N No authorized routine named "TO DATE " of type "FUNCTION" having
compatible arguments was found .SQLSTATE = 42884

attache my error

Thank you so much

with regards
jeevanjosh
 
error output