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 6372667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:16:02+00:00 2026-05-25T01:16:02+00:00

I am building an in-line SQL query (no need to comment about this I

  • 0

I am building an in-line SQL query (no need to comment about this I know its not the best method but its how the company does things!) and I need to compare an Oracle DATE column with C# DateTime.Now. What conversions do I need to put around the DateTime.Now and the column in order to get this comparison to work? (I want to compare the whole DateTime object not just the Date part)

  • 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-25T01:16:03+00:00Added an answer on May 25, 2026 at 1:16 am

    You can use the Oracle TO_DATE function.

    WHERE someDateColumn <= TO_DATE(c#_date, 'YYYY/MM/DD')
    

    For the c# date (see custom date and time strings):

    DateTime.Now.ToString("yyyy/MM/dd")
    

    If you want to add hours/minutes/seconds, you can modify accordingly.

    edit – Actually since you mentioned the whole thing and not just the date, I’ll add it. 🙂

    WHERE someDateColumn <= TO_DATE(c#_date, 'YYYY/MM/DD HH24:MI:SS')
    DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
    

    At home so I can’t run it, but that should work.

    To build a string with the where clause, you’d do this:

    string someQuery = "SELECT * FROM aTable WHERE someDateColumn <=  TO_DATE('" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "', 'YYYY/MM/DD')"
    

    If you wanted to use a specific date rather then DateTime.Now, just put the variable holding it there instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been getting this undefined symbol building with this command line: $ gcc test.cpp
I'm building a website and I have tested this sql statement on the production
I am building a line graph application using Raphael.js and need to draw a
Refer to this post compile a Xcode project in command line Building Qt Xcode
I'm building few command-line utilities in Xcode (plain C, no Cocoa). I want all
Building on what has been written in SO question Best Singleton Implementation In Java
Building a Django app on a VPS. I am not very experienced with setting
I'm building a simple app and trying to test DB result output. But unfortunately
SQL Server 2008 Ent ASP.NET MVC 2.0 Linq-to-SQL I am building a gaming site,
I am building a jcr query and receive data from repository. Here is my

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.