I have got to update a date field from java. vSql = "UPDATE R5PERMEVENTS SET PEV_DATE ='" +new java.sql.Date(vCurrentDate.getTime())+"' WHERE PEV_ACTIVE = '+'"; Now the problem is : new java.sql.Date(vCurrentDate.getTime()) returns values as'2004-07-30 so the query becomes: UPDATE R5PERMEVENTS SET PEV_DATE ='2004-07-30' WHERE PEV_ACTIVE = '+'
Now the oracle doesnot underatand the date format. How do i change the query in runtime as UPDATE R5PERMEVENTS SET PEV_DATE ='30-JUL-2004' WHERE PEV_ACTIVE = '+'
Thanks for the reply. I have one query: Currently in Oracle to enter the date it understands the format dd-MMM-YYYY, can the database setting can change to enter date in different format depending on th local, say for eg. mm/dd/yy. In that case will this Datformat of dd-MMM-yyyy will work. Is it universal format will it wotk on every database as i do not wnat to change the format of the date in code.
I had to handle dates to a SqlServer 7.0 database. I used plain Strings to get the date: ... s = rs.get (3); and without modifying it, wrote it back: ... query = "INSERT INTO ...." + s + " ...."; It worked well on Jun-12, but not on Jun-13
Times are a real problem on computers, because you have: - a hardware-generated time - an os level above, which might use a local time, while the hardware uses GMT. - a programming languange, which might know of the OS-time, or might not know - using the OS-time or being called with a customized setting - databases, maybe using global, local, or customized times - clients, which bring in a third time, with the same possibilities.