jasonseay Posted December 5, 2003 Posted December 5, 2003 I'm trying to get records from an oracle database based on dates. But when i send it the command : Select * from TableName Where Timestamp > '12/01/2003 10:00:00' it gives me an error I have tried several formats for the date time string and i get errors on all of them. The only thing i can get to work is using sysdate, and making calculations based on now() and the date given. This works somewhat but it is not exact. can anyone help with an example query string in vb.net to send it a date and time and have it return the records between that time. Thanks. Quote
techmanbd Posted December 6, 2003 Posted December 6, 2003 try this command Select * from TableName Where Timestamp > '01-DEC-2003: 10:00:00' basically the format for date and time in oracle is DD-MON-YYYY: HH: MI: SS and the HH is 24 hour clock if you are just lookig at dates then it is 'DD-MON-YYYY' and if you don't specify a time then oracle assumes the time is 12:00:00 AM Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
techmanbd Posted December 6, 2003 Posted December 6, 2003 OR i belive you can do this Select * from TableName Where Timestamp > TO_DATE('12/01/2003 10:00:00') and oracle will translate it into Oracle type Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.