Datatable select method to select date

Posted on 2006-05-08
Last Modified: 2009-12-16
I have a datatable that contain column of data type datetime.

for example:
i have a column name 'Ndate' that have datavalue '03-29-2006 12:00:00AM'

i want to select rows that 'Ndate' is '03/29/2006'.

Could anyone pls tell me how can i select it using method..?
Question by:A91627
    LVL 7

    Expert Comment


    Author Comment

    Sorry. Allow me to make me clear...

    Actually i want to select date only from date time column.

    For example:

    column [Date]
    '03/29/2006 12:00:00A.M'

    and i want to select it date only like

    is there any way like convert datetime to date only or select date only in method..?

    I have tried"Convert(date, Varchar)"), but the result is a error message like this :
    'Invalid datatype Varchar'

    LVL 9

    Accepted Solution

    dt.Select("[date] = #2006-03-29#)
    should give you what you want.
    LVL 34

    Assisted Solution

    Or, if tolgaong's suggestion doesn't work (I haven't tried it), see this

    That concerns a DataView .RowFilter, but the same expression rules apply to DataTable .Select.


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now