Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:49:53+00:00 2026-05-27T06:49:53+00:00

I am passing a date (DateTime.Now) from C# code to Oracle procedure. I wanted

  • 0

I am passing a date (DateTime.Now) from C# code to Oracle procedure. I wanted to retrieve all the values from table between

DateTime.Now – 1 11:10:00 AM to DateTime.Now 11:09:59 AM

How do I write a oracle condition for this?

Note: Column ‘CreateDate ‘ is a Date

I have this right now..

 CreateDate >= TO_DATE(to_char(in_CreateDate), 'DD-MON-YY') - 1
 and CreateDate <  TO_DATE(to_char(in_CreateDate), 'DD-MON-YY') + 1
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:49:53+00:00Added an answer on May 27, 2026 at 6:49 am

    You can do math on the date as you suggest. Here’s a quick example (you can substitute your DateTime.Now and proper format string instead of my hardcoded example):

    SELECT TRUNC(TO_DATE('05-DEC-2011 05:31:32 PM', 'DD-MON-YYYY HH12:MI:SS PM'))
        + 11/24 + 10/(24*60) AS MyDate FROM dual;
    
    MYDATE                    
    ------------------------- 
    05-DEC-11 11:10:00 AM     
    

    Notice how I’m taking the input date, truncating it (to get the date without the time) and then adding the hours and minutes to that base date.

    You can expand on this to use the BETWEEN keyword and get this:

    SELECT * FROM my_table
    WHERE CreateDate BETWEEN TRUNC(TO_DATE('05-DEC-2011 05:31:32 PM', 
      'DD-MON-YYYY HH12:MI:SS PM')) + 11/24 + 10/(24*60) - 1
    AND TRUNC(TO_DATE('05-DEC-2011 05:31:32 PM', 
      'DD-MON-YYYY HH12:MI:SS PM')) + 11/24 + 10/(24*60);
    

    Or, if you’re always passing DateTime.Now you can just use the date from the database:

    SELECT * FROM my_table    
    WHERE CreateDate BETWEEN TRUNC(sysdate) + 11/24 + 10/(24*60) - 1
    AND TRUNC(sysdate) + 11/24 + 10/(24*60);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm passing a date from Ruby to Javascript via JSON. It comes into Javascript
From my controller I am passing two instance variables @events = Event.all and @images
I am passing in Dates into an Oracle stored procedure. I keep managing to
I'm currently passing some date-time info to a web page using url parameters, which
We have an application parsing date/time values in the following format: 2009-10-10 09:19:12.124 2009-10-10
I'm using SimpleDateFormat with the pattern EEE MM/dd hh:mma , passing in the date
I'm passing in a bunch of key-value pairs as parameters to a XSL (date
warning: passing argument 1 of 'bsearch' makes pointer from integer without a cast and
If I get the RFC-1123 formatted date of a DateTime object, it gives the
I have a column in a table in which we are storing date in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.