Convert DateTime into MM/DD/YYYY format???

Posted on 2008-11-19
Last Modified: 2012-05-05

I have this gridview and using this filterexpresson thing.
So I pass the where statement to gridview and I am trying to compare date field.
I am trying to look for past dated items.

Find 60 days past due from today:
Select * from orders where [expiratiodate] < getdate()-60;
This works find in SQL but doesn't work with the C# gridview.
HOw can fix this so it will work?
Gridview.FilterExpresson = "[expirationdate] < GetDate() - 60"
[expirationdate] field is Smalll Date field in sql.
Question by:dkim18
    LVL 8

    Accepted Solution


    DateTime.Now.Subtract(new TimeSpan(60,0,0,0));

    Will that work?
    LVL 22

    Assisted Solution

    What is the current format for expirationdate?

    Author Comment

    I put '' and it worked out ok.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Ajax and MVC 2 57
    Add row in datatable to session in 2 58
    Disable & as shortcut in label 3 26
    Refresh page ASP.NET C# 3 39
    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    734 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

    24 Experts available now in Live!

    Get 1:1 Help Now